Skip to content

Commit

Permalink
Add docs for ErrorEvent.error (#36305)
Browse files Browse the repository at this point in the history
add docs for `ErrorEvent.error`
  • Loading branch information
skyclouds2001 authored Oct 11, 2024
1 parent 816cc4d commit 1442d92
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions files/en-us/web/api/errorevent/error/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "ErrorEvent: error property"
short-title: error
slug: Web/API/ErrorEvent/error
page-type: web-api-instance-property
browser-compat: api.ErrorEvent.error
---

{{APIRef("HTML DOM")}}{{AvailableInWorkers}}

The **`error`** read-only property of the {{domxref("ErrorEvent")}} interface returns a JavaScript value, such as an {{jsxref("Error")}} or {{domxref("DOMException")}}, representing the error associated with this event.

## Value

Any valid JavaScript value.

## Examples

```js
window.addEventListener("error", (ev) => {
console.log("The error instance: " + ev.error);
});
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
2 changes: 1 addition & 1 deletion files/en-us/web/api/errorevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _Also inherits properties from its parent {{domxref("Event")}}_.
- {{domxref("ErrorEvent.colno")}} {{ReadOnlyInline}}
- : An `integer` containing the column number of the script file on which the error occurred.
- {{domxref("ErrorEvent.error")}} {{ReadOnlyInline}}
- : A JavaScript `Object` that is concerned by the event.
- : A JavaScript value, such as an {{jsxref("Error")}} or {{domxref("DOMException")}}, representing the error associated with this event.

## Instance methods

Expand Down

0 comments on commit 1442d92

Please sign in to comment.