Web/API/Response/error

From Get docs


The error() method of the Response interface returns a new Response object associated with a network error.

Note: This is mainly relevant to ServiceWorkers; the error method is used to return an error if you so wish it. An error response has its type set to error.


Note: An "error" Response never really gets exposed to script: such a response to a fetch() would reject the promise.


Syntax

var errorResponse = Response.error();

Parameters

None.

Return value

A Response object.

Example

TBD (does not yet appear to be supported anywhere).

Specifications

Specification Status Comment
FetchThe definition of 'error()' 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

error

Experimental'

Chrome

Full support Yes

Edge

Full support 16

Firefox

Full support Yes

IE

No support No

Opera

Full support Yes

Safari

Full support Yes

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.'
Experimental. Expect behavior to change in the future.


See also