* Extract error message from response data
(data: unknown, fallback: string)
| 288 | * Extract error message from response data |
| 289 | */ |
| 290 | private extractErrorMessage(data: unknown, fallback: string): string { |
| 291 | if (typeof data === "object" && data !== null && "message" in data) { |
| 292 | const record = data as Record<string, unknown>; |
| 293 | const msg = record["message"]; |
| 294 | if (typeof msg === "string") { |
| 295 | return msg; |
| 296 | } |
| 297 | } |
| 298 | return fallback; |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Get human-readable error message for HTTP status codes |