Commit cc5e838dce2fc6b64f1607e8a71f33b4676fc604
Remove fallback error handler when tabs are ready
Charles Lehner committed on 9/9/2016, 7:36:56 PMParent: cebcd567601116ec38e6c09a6add1521f9a56f53
Files changed
index.js | changed |
modules/tabs.js | changed |
index.js | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 … | var h = require('hyperscript') |
2 | 2 … | |
3 | -window.addEventListener('error', function onError(e) { | |
3 … | +window.addEventListener('error', window.onError = function (e) { | |
4 | 4 … | document.body.appendChild(h('div.error', |
5 | 5 … | h('h1', e.message), |
6 | 6 … | h('big', h('code', e.filename + ':' + e.lineno)), |
7 | 7 … | h('pre', e.error ? (e.error.stack || e.error.toString()) : e.toString()))) |
modules/tabs.js | ||
---|---|---|
@@ -160,8 +160,15 @@ | ||
160 | 160 … | errorsContent |
161 | 161 … | ) |
162 | 162 … | ) |
163 | 163 … | |
164 … | + // remove loader error handler | |
165 … | + if (window.onError) { | |
166 … | + window.removeEventListener('error', window.onError) | |
167 … | + delete window.onError | |
168 … | + } | |
169 … | + | |
170 … | + // put errors in a tab | |
164 | 171 … | window.addEventListener('error', function (ev) { |
165 | 172 … | var err = ev.error || ev |
166 | 173 … | if(!tabs.has('errors')) |
167 | 174 … | tabs.add('errors', errors, false) |
Built with git-ssb-web