Back to Content

ErrorEvent

files/en-us/web/api/errorevent/index.md

latest1.6 KB
Original Source

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

The ErrorEvent interface represents events providing information related to errors in scripts or in files.

{{InheritanceDiagram}}

Constructor

  • {{domxref("ErrorEvent.ErrorEvent", "ErrorEvent()")}}
    • : Creates an ErrorEvent event with the given parameters.

Instance properties

Also inherits properties from its parent {{domxref("Event")}}.

  • {{domxref("ErrorEvent.message")}} {{ReadOnlyInline}}
    • : 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}}
    • : An integer containing the line number of the script file on which the error occurred.
  • {{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 value, such as an {{jsxref("Error")}} or {{domxref("DOMException")}}, representing the error associated with this event.

Instance methods

Inherits methods from its parent {{domxref("Event")}}.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • 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