(err: unknown)
| 27 | |
| 28 | /** @public Exported for use by external consumers (e.g., VS Code extension). */ |
| 29 | export const isApiErrorResponse = (err: unknown): err is ApiErrorResponse => { |
| 30 | return ( |
| 31 | typeof err === "object" && |
| 32 | err !== null && |
| 33 | "message" in err && |
| 34 | typeof err.message === "string" && |
| 35 | (!("detail" in err) || |
| 36 | err.detail === undefined || |
| 37 | typeof err.detail === "string") && |
| 38 | (!("validations" in err) || |
| 39 | err.validations === undefined || |
| 40 | Array.isArray(err.validations)) |
| 41 | ); |
| 42 | }; |
| 43 | |
| 44 | export const hasApiFieldErrors = (error: ApiError): boolean => |
| 45 | Array.isArray(error.response.data.validations); |
no outgoing calls
no test coverage detected