Files: 6dbc799416e7828344ed4ab645ebde51f3ddaea0 / app / page / errors.js
711 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({ className: 'Errors', title: '/errors' }) |
15 | |
16 | container.id = JSON.stringify(location) |
17 | // note this page needs an id assigned as it's not added by addPage |
18 | |
19 | function addError (err) { |
20 | const error = h('Error', [ |
21 | h('header', err.message), |
22 | h('pre', err.stack) |
23 | ]) |
24 | |
25 | content.appendChild(error) |
26 | } |
27 | |
28 | return { container, addError } |
29 | } |
30 | } |
31 |
Built with git-ssb-web