(error: unknown)
| 326 | * `lastError` / `errors`. |
| 327 | */ |
| 328 | export function extractApiErrorDetails(error: unknown): ApiErrorDetails { |
| 329 | for (const candidate of getApiErrorCandidates(error)) { |
| 330 | const statusCode = getApiErrorStatusCode(candidate) |
| 331 | const parsed = parseApiErrorResponseBody(getApiErrorResponseBody(candidate)) |
| 332 | |
| 333 | if (statusCode !== undefined || hasParsedApiErrorDetails(parsed)) { |
| 334 | return { |
| 335 | ...parsed, |
| 336 | ...(statusCode !== undefined && { statusCode }), |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | return {} |
| 342 | } |
| 343 | |
| 344 | // Extended error properties that various libraries add to Error objects |
| 345 | interface ExtendedErrorProperties { |
no test coverage detected