Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/apiresponse.py
Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | |||||
def error_response_handler( | def error_response_handler( | ||||
exc: Exception, context: Dict[str, Any] | exc: Exception, context: Dict[str, Any] | ||||
) -> Optional[HttpResponse]: | ) -> Optional[HttpResponse]: | ||||
"""Custom DRF exception handler used to generate API error responses. | """Custom DRF exception handler used to generate API error responses. | ||||
""" | """ | ||||
sentry_capture_exception(exc) | sentry_capture_exception(exc) | ||||
doc_data = getattr(exc, "doc_data", None) | doc_data = getattr(exc, "doc_data", {}) | ||||
return error_response(context["request"], exc, doc_data) | return error_response(context["request"], exc, doc_data) |