-
Notifications
You must be signed in to change notification settings - Fork 396
Open
Description
The project currently relies on built-in error classes such as ValidationError and GraphQLError without a unified structure for handling or formatting errors.
Proposed Enhancement
Introduce a centralized custom error-handling mechanism to:
- Standardize error responses across all modules
- Improve debugging and client-side error parsing
- Ensure consistent use of error codes and messages
Benefits
- Easier maintenance and scalability
- Clearer and more predictable API responses
- Simplified client integration and error tracking
Steps to Reproduce
Below are examples of inconsistent error responses across different scenarios:
Failed Login
{
"errors": [
{
"message": "GraphQlValidationError",
"locations": [{ "line": 2, "column": 3 }],
"path": ["tokenAuth"],
"extensions": {
"non_field_errors": [
{
"message": "No active account found with the given credentials",
"code": "no_active_account"
}
]
}
}
],
"data": { "tokenAuth": null }
}Failed Signup
{
"errors": [
{
"message": "GraphQlValidationError",
"locations": [{ "line": 2, "column": 3 }],
"path": ["signUp"],
"extensions": {
"email": [
{
"message": "This field must be unique.",
"code": "unique"
}
]
}
}
],
"data": { "signUp": null }
}Invalid Access Token
{
"detail": {
"message": "Given token not valid for any token type",
"code": "token_not_valid"
},
"code": {
"message": "token_not_valid",
"code": "token_not_valid"
},
"messages": [
{
"token_class": {
"message": "AccessToken",
"code": "token_not_valid"
},
"token_type": {
"message": "access",
"code": "token_not_valid"
},
"message": {
"message": "Token is invalid or expired",
"code": "token_not_valid"
}
}
],
"is_error": true
}System Info
Ubuntu 22.04 (x86_64)Logs
No response
Validations
- Followed the [Code of Conduct](https://github.com/apptension/saas-boilerplate/blob/master/CODE_OF_CONDUCT.md)
- Reviewed the [Contributing Guidelines](https://github.com/apptension/saas-boilerplate/blob/master/CONTRIBUTING.md)
- Read the [documentation](https://docs.demo.saas.apptoku.com/)
- Verified that no duplicate issue exists
- Confirmed that this is a concrete bug (not a discussion topic)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels