(data: unknown, fallback: string)
| 13 | |
| 14 | /** Extract a human-readable error message from a Linq error response body. */ |
| 15 | export function extractLinqError(data: unknown, fallback: string): string { |
| 16 | if (data && typeof data === 'object') { |
| 17 | const record = data as Record<string, unknown> |
| 18 | const error = record.error |
| 19 | if (error && typeof error === 'object') { |
| 20 | const message = (error as Record<string, unknown>).message |
| 21 | if (typeof message === 'string' && message.length > 0) return message |
| 22 | } |
| 23 | if (typeof record.message === 'string' && record.message.length > 0) return record.message |
| 24 | } |
| 25 | return fallback |
| 26 | } |
| 27 | |
| 28 | interface MessageContentInput { |
| 29 | text?: string |
no outgoing calls
no test coverage detected