ErrorEvent
ErrorEvent
事件对象在脚本发生错误时产生,它可以提供发生错误的脚本文件的文件名,以及发生错误时所在的行号等信息。
属性
除了从 Event
接口继承来的属性外,还有下面这些自身属性。
ErrorEvent.prototype.message
只读-
一个
字符串
,包含了所发生错误的描述信息。 ErrorEvent.prototype.filename
只读-
一个
字符串
,包含了发生错误的脚本文件的文件名。 ErrorEvent.prototype.lineno
只读-
一个数字,包含了错误发生时所在的行号。
ErrorEvent.prototype.colno
只读-
一个数字,包含了错误发生时所在的列号。
ErrorEvent.prototype.error
只读 实验性-
发生错误时所抛出的
Error
对象。
构造函数
ErrorEvent()
-
根据传入的参数构造
ErrorEvent
实例。
方法
除了从 Event
接口继承来的方法外,没有其他方法。
规范
Specification |
---|
HTML # the-errorevent-interface |
浏览器兼容性
Report problems with this compatibility data on GitHubLegend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
参见
- 使用 web worker,最有可能引发此事件的对象