Skip to content

Instantly share code, notes, and snippets.

@brillout
Last active June 28, 2022 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brillout/729c3178cfc9bc9c3517fadced7abd17 to your computer and use it in GitHub Desktop.
Save brillout/729c3178cfc9bc9c3517fadced7abd17 to your computer and use it in GitHub Desktop.
// Doesn't work in Chrome
window.onerror = () => {
console.log('window.onerror')
return true
}
window.addEventListener('error', ev => {
ev.preventDefault()
console.log("window.addEventListener('error')")
return true
})
setTimeout(() => {
const scriptEl = document.createElement('script')
scriptEl.src = '/pages/index.page.04984eb5.js'
scriptEl.addEventListener('error', (err) =>{
ev.preventDefault()
console.log("scriptEl.addEventListener('error')")
return true
})
scriptEl.onerror = (ev) => {
ev.preventDefault()
console.log('scriptEl.onerror')
return true
}
document.head.appendChild(scriptEl)
}, 1000)
/*
setTimeout(() => {
throw new Error('Some R')
}, 2000)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment