Note: This feature is available in Web Workers.
The message read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.
A string.
window.addEventListener("error", (ev) => {
console.log(`The error message: ${ev.message}`);
});
| Specification |
|---|
| HTML> # dom-errorevent-message> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
message |
10 | 12 | 27 | 11 | 6 | 18 | 27 | 11 | 6 | 1.0 | 4.4 | 6 |
© 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/message