Error: fileName - JavaScript | MDN

Value

A string.

Property attributes of Error: fileName
Writableyes
Enumerableno
Configurableyes

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

js

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

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.