MDN self-hosted library · e01.org

Error: fileName

The fileName data property of an Error instance contains the path to the file that raised this error.

Open notebook · 1 cells javascript-instance-data-property upstream source

The fileName data property of an Error instance contains the path to the file that raised this error.

Value

A string.

0

Description

This non-standard property contains the path to the file that raised this error. If called from a debugger context, the Firefox Developer Tools for example, "debugger eval code" is returned.

Examples

Using fileName

const e = new Error("Could not parse input");
throw e;
// e.fileName could look like "file:///C:/example.html"

Specifications

Not part of any standard.

Browser compatibility

See also

  • Error.prototype.stack
  • Error.prototype.columnNumber
  • Error.prototype.lineNumber