错误:fileName

Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Error 实例的 fileName 数据属性包含引发此错误的文件的路径。

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

¥Value

一根绳子。

¥A string.

Property attributes of 错误:fileName
Writable yes
Enumerable no
Configurable yes

描述

¥Description

此非标准属性包含引发此错误的文件的路径。如果从调试器上下文调用,则返回 Firefox 开发者工具,例如 "调试器评估代码"。

¥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.

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看