* Centralized API error message extraction * * The API client interceptor rejects with a plain object: { status, code, message, error } * This utility extracts the user-facing message from any error shape.
| 6 | */ |
| 7 | |
| 8 | interface ApiErrorLike { |
| 9 | status?: number |
| 10 | code?: number | string |
| 11 | message?: string |
| 12 | error?: string |
| 13 | reason?: string |
| 14 | metadata?: Record<string, unknown> |
| 15 | response?: { |
| 16 | data?: { |
| 17 | detail?: string |
| 18 | message?: string |
| 19 | code?: number | string |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Extract the error code from an API error object. |
nothing calls this directly
no outgoing calls
no test coverage detected