diff --git a/steering/settings.py b/steering/settings.py index 16eb0590c4253180e16d823442f84b957627526e..b36e961ae26b1b265013c67f1d2a2152b5fd3333 100644 --- a/steering/settings.py +++ b/steering/settings.py @@ -109,6 +109,7 @@ REST_FRAMEWORK = { "program.auth.OidcOauth2Auth", ], "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"], + "EXCEPTION_HANDLER": "steering.views.full_details_exception_handler", } INSTALLED_APPS = ( diff --git a/steering/views.py b/steering/views.py new file mode 100644 index 0000000000000000000000000000000000000000..0eb278d58db73c88f476616c19ad60ad54d12076 --- /dev/null +++ b/steering/views.py @@ -0,0 +1,8 @@ +from rest_framework.exceptions import APIException +from rest_framework.views import exception_handler + + +def full_details_exception_handler(exc, context): + if isinstance(exc, APIException): + exc.detail = exc.get_full_details() + return exception_handler(exc, context)