Skip to content

Commit

Permalink
Add docs for ErrorEvent.message (mdn#36280)
Browse files Browse the repository at this point in the history
* add

* add a simple example
  • Loading branch information
skyclouds2001 authored Oct 11, 2024
1 parent 7d6ffd0 commit ac29130
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
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 @@ -21,7 +21,7 @@ The **`ErrorEvent`** interface represents events providing information related t
_Also inherits properties from its parent {{domxref("Event")}}_.

- {{domxref("ErrorEvent.message")}} {{ReadOnlyInline}}
- : A string containing a human-readable error message describing the problem. Lacking a [`crossorigin`](/en-US/docs/Web/HTML/Attributes/crossorigin) setting reduces error logging.
- : A string containing a human-readable error message describing the problem.
- {{domxref("ErrorEvent.filename")}} {{ReadOnlyInline}}
- : A string containing the name of the script file in which the error occurred.
- {{domxref("ErrorEvent.lineno")}} {{ReadOnlyInline}}
Expand Down
31 changes: 31 additions & 0 deletions files/en-us/web/api/errorevent/message/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "ErrorEvent: message property"
short-title: message
slug: Web/API/ErrorEvent/message
page-type: web-api-instance-property
browser-compat: api.ErrorEvent.message
---

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

The **`message`** read-only property of the {{domxref("ErrorEvent")}} interface returns a string containing a human-readable error message describing the problem.

## Value

A string.

## Examples

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

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

0 comments on commit ac29130

Please sign in to comment.