get_exception_response
Resolves and executes the error handler for a given status code, falling back to a generic uncaught exception handler and triggering a failure signal if the primary callback fails.
def get_exception_response(
request: HttpRequest,
resolver: URLResolver,
status_code: int,
exception: Exception
) - > HttpResponse
Retrieves the appropriate HTTP response for a given status code and exception by invoking the registered error handler. If the error handler fails, it triggers a request exception signal and falls back to the uncaught exception handler.
Parameters
| Name | Type | Description |
|---|---|---|
| request | HttpRequest | The current web request object being processed. |
| resolver | URLResolver | The URL resolver used to locate the appropriate error handler callback for the given status code. |
| status_code | int | The HTTP status code (e.g., 404, 500) for which an error response is required. |
| exception | Exception | The exception instance that triggered the error response generation. |
Returns
| Type | Description |
|---|---|
HttpResponse | The response object generated by the resolved error handler or the fallback uncaught exception handler. |