(response: ErrorResponse)
| 5 | }; |
| 6 | |
| 7 | export async function getErrorMessage(response: ErrorResponse) { |
| 8 | try { |
| 9 | const data = (await response.json()) as { error?: string }; |
| 10 | if (typeof data.error === "string" && data.error.length > 0) { |
| 11 | return data.error; |
| 12 | } |
| 13 | } catch { |
| 14 | // Ignore invalid error payloads and fall back to the status text below. |
| 15 | } |
| 16 | |
| 17 | return response.statusText || `Request failed with status ${response.status}`; |
| 18 | }; |
no outgoing calls
no test coverage detected