-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Title: Update Error Handling to Match New Back-End Format
Goal:
Ensure consistent and clear error handling by aligning with the new back-end error format. Create a centralized function to handle all errors efficiently.
New Back-End Error Format Examples:
- Validation Error:
{
"status": 400,
"error": "BAD_REQUEST",
"message": "Validation failed: One or more fields contain invalid values.",
"path": "/auth/register",
"timestamp": "2025-01-19T11:28:28.6543834",
"details": [
{
"field": "password",
"message": "organization.password.size",
"constraint": "Size",
"value": "123"
}
]
}
- Server Error:
{
"status": 500,
"error": "INTERNAL_SERVER_ERROR",
"message": "User already exists with email: mohsenk.work@gmail.com",
"path": "/auth/register",
"timestamp": "2025-01-19T11:27:25.8701854",
"details": []
}
Tasks:
-
Centralized Error Handling:
- Implement a utility function to process and display errors.
- Format errors for easy understanding by users and developers.
-
Error Categorization:
- Handle validation errors (400) and server errors (500) differently.
- Use
details
for field-specific messages in validation errors.
-
User-Friendly Messages:
- Provide clear and actionable feedback (e.g., "Password must be at least 8 characters").
- Simplify server error messages to avoid exposing sensitive data.
-
Testing:
- Ensure all endpoints use the new error-handling approach.
- Test with various scenarios like missing fields, invalid inputs, and server issues.
Acceptance Criteria:
- Centralized error handling is implemented and used across all endpoints.
- Errors are clear, consistent, and actionable.
Metadata
Metadata
Assignees
Labels
No labels