Note: This feature is available in Web Workers.
The error read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.
Any valid JavaScript value.
window.addEventListener("error", (ev) => {
console.log(`The error instance: ${ev.error}`);
});
| Specification |
|---|
| HTML> # dom-errorevent-error> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
error |
30 | 12 | 31 | 17 | 10 | 30 | 31 | 18 | 10 | 2.0 | 4.4 | 10 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent/error