ErrorEvent:error 属性
备注: 此特性在 Web Worker 中可用。
ErrorEvent
接口的 error
只读属性返回一个表示与事件关联错误的 JavaScript 值,例如 Error
或 DOMException
。
值
任何有效的 JavaScript 值。
示例
js
window.addEventListener("error", (ev) => {
console.log("错误实例:" + ev.error);
});
规范
Specification |
---|
HTML # dom-errorevent-error |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error |
Legend
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.