Delegate ExceptionHandlerCallback
A callback used to provide information about an unhandled exception occurred while processing a request.
Namespace: EmbedIO
Syntax
public delegate Task ExceptionHandlerCallback(IHttpContext context, Exception exception);
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | An IHttpContext interface representing the context of the request. |
Exception | exception | The unhandled exception. |
Returns
Type | Description |
---|---|
Task | A |
Remarks
When this delegate is called, the response's status code has already been set to
Any exception thrown by a handler (even a HTTP exception) will go unhandled: the web server
will not crash, but processing of the request will be aborted, and the response will be flushed as-is.
In other words, it is not a good ides to throw HttpException.NotFound()
(or similar)
from a handler.