WorkerGlobalScope: reportError() method

Note: This feature is only available in Web Workers.

The reportError() method of the WorkerGlobalScope interface may be used to report errors to the console or event handlers of global scopes, emulating an uncaught JavaScript exception.

This feature is primarily intended for custom event-dispatching or callback-manipulating libraries. Libraries can use this feature to catch errors in callback code and re-throw them to the top level handler. This ensures that an exception in one callback will not prevent others from being handled, while at the same time ensuring that stack trace information is still readily available for debugging at the top level.

See window.reportError() for more information.

Syntax

js
reportError(throwable)

Parameters

throwable

Any JavaScript value, but preferably an error object such as a TypeError.

Return value

None (undefined).

Exceptions

TypeError

The method is called without an error argument.

Specifications

Specification
HTML
# runtime-script-errors

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
reportError
Chrome – Full support
Chrome 95 (Release date: 2021-10-19)
footnote Full support
Edge – Full support
Edge 95 (Release date: 2021-10-21)
footnote Full support
Firefox – Full support
Firefox 93 (Release date: 2021-10-05)
footnote Full support
Opera – Full support
Opera 81 (Release date: 2021-11-04)
footnote Full support
Safari – Full support
Safari 15.4 (Release date: 2022-03-14)
footnote Full support
Chrome Android – Full support
Chrome Android 95 (Release date: 2021-10-19)
footnote Full support
Firefox for Android – Full support
Firefox for Android 93 (Release date: 2021-10-05)
footnote Full support
Opera Android – Full support
Opera Android 67 (Release date: 2022-01-31)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15.4 (Release date: 2022-03-14)
footnote Full support
Samsung Internet – Full support
Samsung Internet 17 (Release date: 2022-05-04)
footnote Full support
WebView Android – Full support
WebView Android 95 (Release date: 2021-10-19)
footnote Full support
WebView on iOS – Full support
WebView on iOS 15.4 (Release date: 2022-03-14)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1.21 (Release date: 2022-04-21)
footnote Full support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also