Closed YuryYatskov closed 2 years ago
I found a solution, I can use map
static ProblemDetails Mapping<TException>(TException ex, int sc) where TException : Exception =>
new ExceptionProblemDetails(ex, sc) {
Detail = ex.Message
};
and
options.Map<DuplicateWaitObjectException>(ex => Mapping(ex, StatusCodes.Status400BadRequest));
Hello, it seems this is rather common problem. In #105 I've found ExceptionProblemDetails
is deprecated. I also found a solution using Map
and StatusCodeProblemDetails.Create
.
However, I think it would be nice to have it configurable via Options
(Something like IncludeExceptionMessage
) and use the perfectly readable MapToStatusCode
.
I need a short message on a productive environment.
When i use
I have without
detail
When
true
, I have withexceptionDetails
I need a option for see only
detail