mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-08-01 09:13:23 +08:00
14 lines
417 B
Python
14 lines
417 B
Python
from rest_framework.views import exception_handler
|
|
from rest_framework.response import Response
|
|
from rest_framework import status
|
|
|
|
|
|
def custom_exception_handler(exc, context):
|
|
response = exception_handler(exc, context)
|
|
|
|
# We overwrite the response status code to 500
|
|
if response is not None:
|
|
return Response({'detail': str(exc)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
|
|
return response
|