Open xivind opened 3 months ago
Partly fixed with code below, must be present in all endpoints. Does not catch 404 errors.. Maybe also something to catch errors that are caused when non-existent endpoints are called?
`except Exception as error:
if isinstance(error, HTTPException):
# If the exception is an HTTPException, handle it accordingly
if error.status_code == status.HTTP_503_SERVICE_UNAVAILABLE:
# Handle 503 Service Unavailable error
return render_error_page(request, error.status_code, str(error.detail))
else:
# Handle other HTTP errors
return render_error_page(request, error.status_code, str(error.detail))
else:
# Handle other exceptions (e.g., internal server errors)
return render_error_page(request, 500, str(error))`
All endpoints must have try / except blocks