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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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.
WorkerGlobalScope.onerror by Mozilla Contributors is licensed under CC-BY-SA 2.5.