Function
createApiError
(
message: string | undefined,
opts?: {
status?: number
cause?: unknown
error?: unknown
},
)
Source from the content-addressed store, hash-verified
| 11 | } |
| 12 | |
| 13 | function createApiError( |
| 14 | message: string | undefined, |
| 15 | opts?: { |
| 16 | status?: number |
| 17 | cause?: unknown |
| 18 | error?: unknown |
| 19 | }, |
| 20 | ): APIError { |
| 21 | const error = new Error(message ?? '', opts?.cause ? { cause: opts.cause } : undefined) as Error & |
| 22 | APIError & { |
| 23 | error?: unknown |
| 24 | } |
| 25 | error.status = opts?.status as APIError['status'] |
| 26 | if (opts?.error !== undefined) { |
| 27 | error.error = opts.error |
| 28 | } |
| 29 | return error |
| 30 | } |
| 31 | |
| 32 | describe('errorUtils', () => { |
| 33 | it('formats wrapped SSL verification failures as actionable proxy guidance', () => { |
Tested by
no test coverage detected