Skip to content

Function: createFetchError()

createFetchError(response, url?): Promise<Error>

Build an Error describing a failed fetch response: status line, the URL(s) involved (the requested url and the final response.url after redirects, de-duplicated), and a truncated snapshot of the response body. Reads the body defensively - a body that can’t be read is simply omitted. Call only on a non-ok response.

Response

string

Promise<Error>