(err: unknown)
| 42 | } |
| 43 | |
| 44 | export function getErrorMessage(err: unknown): string { |
| 45 | if (isSphereError(err)) { |
| 46 | return FRIENDLY_OVERRIDES[err.code] ?? humanizeRawError(err.message); |
| 47 | } |
| 48 | if (err instanceof Error) return humanizeRawError(err.message); |
| 49 | return 'Something went wrong'; |
| 50 | } |
| 51 | |
| 52 | export function getErrorCode(err: unknown): SphereErrorCode | null { |
| 53 | return isSphereError(err) ? err.code : null; |
no test coverage detected