(error: unknown)
| 34 | } |
| 35 | |
| 36 | export function isApiError(error: unknown): error is HttpError & {details: {errors: {code: string}[]}} { |
| 37 | return ( |
| 38 | isHttpError(error) && |
| 39 | !!error.details && |
| 40 | typeof error.details === "object" && |
| 41 | "errors" in error.details && |
| 42 | Array.isArray(error.details.errors) && |
| 43 | error.details.errors.every((e) => typeof e === "object" && "code" in e) |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | /** Throw this to indicate the CLI should exit with a non-zero exit code. */ |
| 48 | export class CliError extends Error { |
no test coverage detected