mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
fix(client): work through the findings from the coverage pass
214 items came out of writing the tests. Real defects are corrected, dead code is removed rather than covered, and the tests that pinned the old behaviour move with them. Also drops two agent coverage scratch files that slipped into the coverage PR and adds the ignore rule that keeps them out.
This commit is contained in:
+3
-1
@@ -406,7 +406,9 @@ export interface ApiError {
|
||||
export function getApiErrorMessage(err: unknown, fallback: string): string {
|
||||
if (typeof err === 'object' && err !== null && 'response' in err) {
|
||||
const apiErr = err as ApiError
|
||||
if (apiErr.response?.data?.error) return apiErr.response.data.error
|
||||
// Axios' own message ("Request failed with status code 500") is untranslated
|
||||
// boilerplate, so only the server's error text beats the localized fallback.
|
||||
return apiErr.response?.data?.error || fallback
|
||||
}
|
||||
if (err instanceof Error) return err.message
|
||||
return fallback
|
||||
|
||||
Reference in New Issue
Block a user