(response: Response, fallback?: string | undefined): Promise<string> Safely extract an error message from a non-ok response.
Handles responses with non-JSON bodies (e.g. HTML 404 pages)
that would throw on response.json().
response
the non-ok response
type
Responsefallback?
fallback message when no .error field is found
type
string | undefinedoptional
returns
Promise<string> error message string