Files: 436b95d0f731a04c71b5f4a1ffcdba5961a2fd92 / app / page / errors.js
739 bytesRaw
1 | const nest = require('depnest') |
2 | const { h } = require('mutant') |
3 | |
4 | exports.gives = nest('app.page.errors') |
5 | |
6 | exports.needs = nest({ |
7 | 'app.html.scroller': 'first' |
8 | }) |
9 | |
10 | exports.create = function (api) { |
11 | return nest('app.page.errors', errorsPage) |
12 | |
13 | function errorsPage (location) { |
14 | var { container, content } = api.app.html.scroller() |
15 | |
16 | container.title = '/errors' |
17 | container.classList = ['Errors'] |
18 | container.id = JSON.stringify(location) |
19 | // note this page needs an id assigned as it's not added by addPage |
20 | |
21 | function addError (err) { |
22 | const error = h('Error', [ |
23 | h('header', err.message), |
24 | h('pre', err.stack) |
25 | ]) |
26 | |
27 | content.appendChild(error) |
28 | } |
29 | |
30 | return { container, addError } |
31 | } |
32 | } |
33 |
Built with git-ssb-web