(error: unknown)
| 154 | }) |
| 155 | ] as const |
| 156 | |
| 157 | function extractToolErrorCode(error: unknown): TempadMcpErrorCode | undefined { |
| 158 | const code = getRecordProperty(error, 'code') |
| 159 | if (isTempadMcpErrorCode(code)) return code |
| 160 | const cause = getRecordProperty(error, 'cause') |
| 161 | const causeCode = getRecordProperty(cause, 'code') |
| 162 | if (isTempadMcpErrorCode(causeCode)) return causeCode |
| 163 | return undefined |
| 164 | } |
| 165 | |
| 166 | function isTempadMcpErrorCode(value: unknown): value is TempadMcpErrorCode { |
| 167 | return typeof value === 'string' && KNOWN_ERROR_CODES.has(value) |
| 168 | } |
| 169 | |
| 170 | function extractToolErrorMessage(error: unknown): string { |
no test coverage detected