Delegate TypedExceptionNormalizer<TException>
Converts an unexpected exception of a specific type into an enriched HttpRequestException.
Namespace: NanoRoute
Assembly: NanoRoute.dll
Syntax
public delegate HttpRequestException TypedExceptionNormalizer<TException>(TException exception) where TException : Exception
Parameters
| Type | Name | Description |
|---|---|---|
| TException | exception | The exception thrown by a later handler in the routing pipeline. |
Returns
| Type | Description |
|---|---|
| HttpRequestException | The HttpRequestException that should be thrown by the exception-handling middleware. |
Type Parameters
| Name | Description |
|---|---|
| TException | The concrete exception type handled by the normalizer. |
Remarks
Use this delegate with ExceptionNormalizer.For<TException>(...) to register typed
normalizers in ExceptionNormalizers without manually casting from
Exception. Normalizers are matched by exact runtime exception type.
Examples
ExceptionNormalizer.For<InvalidOperationException>
(
static ex => new HttpRequestException("Bad state", ex, HttpStatusCode.Conflict)
);