Overview
auth.ts catches all login errors and returns the same "Login failed. Please try again." message regardless of the underlying cause (wrong password, account suspended, server error, network timeout). Users cannot take the correct corrective action.
Specifications
Features:
- Map HTTP status codes and error codes to specific user-facing messages
- 401 → "Incorrect email or password", 403 → "Account suspended. Contact support", 0/network → "Check your internet connection"
Tasks:
- Define a
getLoginErrorMessage(error: AxiosError): string function
- Replace the generic catch with structured error mapping
- Write tests for each error code mapping
Impacted Files:
src/services/auth.ts
src/utils/authErrors.ts
Acceptance Criteria
- Each error type displays a distinct, actionable message
- Network errors prompt connectivity check
- Account lockout directs to support
- All mappings covered by unit tests
Overview
auth.tscatches all login errors and returns the same "Login failed. Please try again." message regardless of the underlying cause (wrong password, account suspended, server error, network timeout). Users cannot take the correct corrective action.Specifications
Features:
Tasks:
getLoginErrorMessage(error: AxiosError): stringfunctionImpacted Files:
src/services/auth.tssrc/utils/authErrors.tsAcceptance Criteria