Skip to content

Commit

Permalink
add docs for ErrorEvent() constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
skyclouds2001 authored Oct 6, 2024
1 parent 3d2cd62 commit 14c0a25
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
47 changes: 47 additions & 0 deletions files/en-us/web/api/errorevent/errorevent/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: "ErrorEvent: ErrorEvent() constructor"
short-title: ErrorEvent()
slug: Web/API/ErrorEvent/ErrorEvent
page-type: web-api-constructor
browser-compat: api.ErrorEvent.ErrorEvent
---

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

The **`ErrorEvent()`** constructor creates a new {{domxref("ErrorEvent")}} object.

## Syntax

```js-nolint
new ErrorEvent(type)
new ErrorEvent(type, options)
```

### Parameters

- `type`
- : A string with the name of the event. It is case-sensitive.
- `options` {{optional_inline}}
- : An object that, _in addition of the properties defined in {{domxref("Event/Event", "Event()")}}_, can have the following properties:
- `message` {{optional_inline}}
- : 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.
- `filename` {{optional_inline}}
- : A string containing the name of the script file in which the error occurred.
- `lineno` {{optional_inline}}
- : An `integer` containing the line number of the script file on which the error occurred.
- `colno` {{optional_inline}}
- : An `integer` containing the column number of the script file on which the error occurred.
- `error` {{optional_inline}}
- : A JavaScript `Object` that is concerned by the event.

### Return value

A new {{domxref("ErrorEvent")}} object.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
4 changes: 3 additions & 1 deletion files/en-us/web/api/errorevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ _Inherits methods from its parent {{domxref("Event")}}_.

## See also

- [Using web workers](/en-US/docs/Web/API/Web_Workers_API/Using_web_workers), most likely objects to raise such an event
- [Using web workers](/en-US/docs/Web/API/Web_Workers_API/Using_web_workers), most likely objects to raise such an event.
- {{domxref("Window")}}: {{domxref("Window/error_event", "error")}} event
- {{domxref("Navigation")}}: {{domxref("Navigation/navigateerror_event", "navigateerror")}} event

0 comments on commit 14c0a25

Please sign in to comment.