Closed murdo-moj closed 3 months ago
How to customise the error view: https://docs.djangoproject.com/en/5.0/topics/http/views/#customizing-error-views
Examples: https://ron.sh/handling-custom-django-error-pages-the-proper-way/
Overriding the 500 handler won't work as we can't access the original exception there:
# All handlers take (request, exception) arguments except handler500
# which takes (request).
Django handles this here https://github.com/django/django/blob/94ab56ee2e24d4764296580da66dbbdc9ba03b02/django/core/handlers/exception.py#L140 https://github.com/django/django/blob/94ab56ee2e24d4764296580da66dbbdc9ba03b02/django/urls/resolvers.py#L731
So looks like we need to implement this as a middleware https://docs.djangoproject.com/en/5.0/topics/http/middleware/#process-exception
data_platform_catalogue
library queries the GraphQL API and it has a 500 error. At the moment, we get the generic 500 error page for find-moj-data, which is uninformative as to if the frontend or backend has caused an error