Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena authored Sep 11, 2024
1 parent 44098a1 commit f718195
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions files/en-us/web/api/window/error_event/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ When canceled, the error won't appear in the console, but the current script wil
The event handler's signature is asymmetric between `addEventListener()` and `onerror`. The event handler passed to `Window.addEventListener()` receives a single {{domxref("ErrorEvent")}} object, while the `onerror` handler receives five arguments, matching the {{domxref("ErrorEvent")}} object's properties:

- `message`

- : A string containing a human-readable error message describing the problem. Same as {{domxref("ErrorEvent.message")}}.

> [!NOTE]
> In HTML, the [content event handler attribute](/en-US/docs/Web/HTML/Attributes#event_handler_attributes) `onerror` on the {{HTMLElement("body")}} element attaches `error` event listeners to `window` (_not_ the `<body>` element). For this event handler, the first parameter is called `event`, not `message`, although it still contains a string; that is, you would use `<body onerror="console.error(event)">` to log the error message.
- `source`
- : A string containing the URL of the script that generated the error.
- `lineno`
Expand Down

0 comments on commit f718195

Please sign in to comment.