<pre></pre>
class Hello extends HTMLElement {
connectedCallback() {
throw new Error('haha!')
}
}
customElements.define('hello-world', Hello)
const element = document.createElement('hello-world')
let caughtError
try {
document.body.appendChild(element)
} catch (error) {
console.log('Caught error?', error)
caughtError = error
}
document.querySelector('pre').innerHTML = 'Error was caught? ' + !!caughtError
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.