| 1 | import axios from 'axios'; |
| 2 | |
| 3 | export class DocumentEngineError extends Error { |
| 4 | public readonly code: string; |
| 5 | public readonly statusCode?: number; |
| 6 | public readonly details?: unknown; |
| 7 | |
| 8 | constructor(message: string, code: string, statusCode?: number, details?: unknown) { |
| 9 | super(message); |
| 10 | this.name = 'DocumentEngineError'; |
| 11 | this.code = code; |
| 12 | this.statusCode = statusCode; |
| 13 | this.details = details; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | export function handleApiError(error: unknown): never { |
| 18 | if (axios.isAxiosError(error)) { |
nothing calls this directly
no outgoing calls
no test coverage detected