feat(api): implement centralized exception handling for unified error responses

- Add custom_exception_handler to handle exceptions in a unified format
- Log errors with request context and provide debug information in development mode
- Update settings.py to use the new exception handler
- Export custom_exception_handler in __init__.py for accessibility

This enhances error management across the API, improving debugging and user experience.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-14 15:50:26 +00:00
parent b6cd544791
commit 66b1868672
3 changed files with 216 additions and 1 deletions

View File

@@ -204,6 +204,7 @@ REST_FRAMEWORK = {
'igny8_core.api.authentication.CSRFExemptSessionAuthentication', # Session auth without CSRF for API
'rest_framework.authentication.BasicAuthentication', # Enable basic auth as fallback
],
'EXCEPTION_HANDLER': 'igny8_core.api.exception_handlers.custom_exception_handler', # Unified error format
}
# CORS Configuration