Error: fileName

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{Non-standard_Header}}

The **fileName** data property of an {{jsxref("Error")}} instance contains the path to the file that raised this error.

Value

A string.

{{js_property_attributes(1, 0, 1)}}

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

{{Compat}}

See also

  • {{jsxref("Error.prototype.stack")}}
  • {{jsxref("Error.prototype.columnNumber")}}
  • {{jsxref("Error.prototype.lineNumber")}}