-
Konrad Mohrfeldt authored
ValueError has no built-in handling in DRF causing it to return an HTML error page. This is unfortunate for clients that expect a JSON error object like the dashboard.
Konrad Mohrfeldt authoredValueError has no built-in handling in DRF causing it to return an HTML error page. This is unfortunate for clients that expect a JSON error object like the dashboard.
exceptions.py 352 B
from rest_framework import status
from rest_framework.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
class ConfigurationError(ValidationError):
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
default_detail = _("Invalid or insufficient server configuration.")
default_code = "misconfigured"