Skip to content

Class ProblemDetailsExceptionHandler

Namespace: Momentum.ServiceDefaults.Api
Assembly: Momentum.ServiceDefaults.Api.dll

Maps unhandled exceptions to RFC 7807 Problem Details responses. Register via DI and activate with app.UseExceptionHandler(). Override to customise the mapping.

csharp
public class ProblemDetailsExceptionHandler : IExceptionHandler

Inheritance

objectProblemDetailsExceptionHandler

Implements

IExceptionHandler

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

ProblemDetailsExceptionHandler()

csharp
public ProblemDetailsExceptionHandler()

Methods

TryHandleAsync(HttpContext, Exception, CancellationToken)

csharp
public virtual ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken)

Parameters

httpContext HttpContext

exception Exception

cancellationToken CancellationToken

Returns

ValueTask<bool>