Added journal reversals.
This commit is contained in:
@@ -10,23 +10,23 @@ public class DomainExceptionHandler : IExceptionHandler
|
||||
Exception exception,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// Only intercept our specific domain/validation exceptions
|
||||
if (exception is InvalidOperationException or ArgumentException)
|
||||
if (exception is not (InvalidOperationException or ArgumentException))
|
||||
{
|
||||
var problemDetails = new ProblemDetails
|
||||
{
|
||||
Status = StatusCodes.Status400BadRequest,
|
||||
Title = "Domain Validation Error",
|
||||
Detail = exception.Message,
|
||||
Type = "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1"
|
||||
};
|
||||
|
||||
httpContext.Response.StatusCode = problemDetails.Status.Value;
|
||||
await httpContext.Response.WriteAsJsonAsync(problemDetails, cancellationToken);
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
var problemDetails = new ProblemDetails
|
||||
{
|
||||
Status = StatusCodes.Status400BadRequest,
|
||||
Title = "Domain Validation Error",
|
||||
Detail = exception.Message,
|
||||
Type = "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.1"
|
||||
};
|
||||
|
||||
httpContext.Response.StatusCode = problemDetails.Status.Value;
|
||||
await httpContext.Response.WriteAsJsonAsync(problemDetails, cancellationToken);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user