Delegate HttpExceptionHandlerCallback
A callback used to build the contents of the response for an IHttpException.
Namespace: EmbedIO
Syntax
public delegate Task HttpExceptionHandlerCallback(IHttpContext context, IHttpException httpException);
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | An IHttpContext interface representing the context of the request. |
IHttpException | httpException | An IHttpException interface. |
Returns
Type | Description |
---|---|
Task | A |
Remarks
When this delegate is called, the response's status code has already been set and the PrepareResponse(IHttpContext) method has already been called. The only thing left to do is preparing the response's content, according to the Message property.
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.