(error: unknown)
| 942 | } |
| 943 | |
| 944 | function normalizeProviderFailure(error: unknown): ModelFailure { |
| 945 | if (isModelFailure(error)) return error; |
| 946 | const summary = providerFailureSummary(error); |
| 947 | const failure = normalizeModelFailure(error); |
| 948 | return { |
| 949 | ...failure, |
| 950 | ...(summary?.code !== undefined ? { code: summary.code } : {}), |
| 951 | ...(failure.kind === 'unknown' && summary !== undefined ? { message: summary.message } : {}), |
| 952 | }; |
| 953 | } |
| 954 | |
| 955 | function isModelFailure(value: unknown): value is ModelFailure { |
| 956 | return ( |
no test coverage detected