W3cubDocs

/Web APIs

Response: error() static method

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

Response.error()

Parameters

None.

Return value

A Response object.

Examples

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

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
error 43 16 39 No 30 10.1 43 43 39 30 10.3 4.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Response/error