ErrorEvent: filename property
Note: This feature is available in Web Workers.
The filename
read-only property of the ErrorEvent
interface returns a string containing the name of the script file in which the error occurred.
Value
A string.
Examples
js
window.addEventListener("error", (ev) => {
console.log("The error occur in file: " + ev.filename);
});
Specifications
Specification |
---|
HTML Standard # dom-errorevent-filename |
Browser compatibility
BCD tables only load in the browser