Open billkiddo opened 6 years ago
@billkiddo Currently working on adding Problem+json support now, interested in your thoughts and opinions around the implementation. This is what I currently have:
app.UseGlobalExceptionHandler(x =>
{
x.Map<ArgumentException>().ToStatusCode(HttpStatusCode.BadRequest).UsingProblemDetails((ex, context) => new ProblemDetails
{
Type = ex.GetType().Name,
Detail = ex.Message,
Title = "There was an error with your request",
Instance = "My instance",
Status = context.StatusCode
});
});
That implementation looks good to me. I thought ProblemDetails was part of 2.1...
Does this simply automatically set the content type?
What is supposed to be used for “Instance” ?
Yes, definitely. I've been looking at a couple of options around implementation.