Web/API/WorkerGlobalScope/onerror

From Get docs

The onerror property of the WorkerGlobalScope interface represents an EventHandler to be called when the error event occurs and bubbles through the Worker.

Syntax

self.onerror = function() { ... };

Example

The following code snippet shows an onerror handler set inside a worker:

self.onerror = function() {
  console.log('There is an error inside your worker!');
}

Specifications

Specification Status Comment
HTML Living StandardThe definition of 'WorkerGlobalScope.onerror' in that specification. Living Standard  

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
onerror Chrome

Full support 4

Edge

Full support 12

Firefox

Full support 3.5

IE

Full support Yes

Opera

Full support 11.5

Safari

Full support 4

WebView Android

Full support 37

Chrome Android

Full support 40

Firefox Android

Full support 4

Opera Android

Full support Yes

Safari iOS

Full support 5.1

Samsung Internet Android

Full support 4.0

Legend

Full support  
Full support


See also

The WorkerGlobalScope interface it belongs to.