git ssb

16+

Dominic / patchbay



Tree: 7ec8576dc1fa3f5fd84478f8aa7f3ea3c6805c81

Files: 7ec8576dc1fa3f5fd84478f8aa7f3ea3c6805c81 / app / sync / initialise / errorCatcher.js

545 bytesRaw
1const nest = require('depnest')
2
3exports.gives = nest('app.sync.initialise')
4
5exports.needs = nest({
6 'router.sync.router': 'first',
7 'app.html.tabs': 'first'
8})
9
10exports.create = function (api) {
11 return nest('app.sync.initialise', errorCatcher)
12
13 function errorCatcher () {
14 const tabs = api.app.html.tabs()
15
16 var { container: errorPage, addError } = api.router.sync.router('/errors')
17 window.addEventListener('error', ev => {
18 if (!tabs.has('/errors')) tabs.add(errorPage, true)
19
20 addError(ev.error || ev)
21 })
22 }
23}
24

Built with git-ssb-web