(fault: BridgeFault, context: string)
| 96 | } |
| 97 | |
| 98 | function throwFault(fault: BridgeFault, context: string): never { |
| 99 | logForDebugging( |
| 100 | `[bridge:debug] Injecting ${fault.kind} fault into ${context}: status=${fault.status} errorType=${fault.errorType ?? 'none'}`, |
| 101 | ) |
| 102 | if (fault.kind === 'fatal') { |
| 103 | throw new BridgeFatalError( |
| 104 | `[injected] ${context} ${fault.status}`, |
| 105 | fault.status, |
| 106 | fault.errorType, |
| 107 | ) |
| 108 | } |
| 109 | // Transient: mimic an axios rejection (5xx / network). No .status on |
| 110 | // the error itself — that's how the catch blocks distinguish. |
| 111 | throw new Error(`[injected transient] ${context} ${fault.status}`) |
| 112 | } |
| 113 | |
| 114 | return { |
| 115 | ...api, |
no test coverage detected