Merge pull request #22600 from dotnet/safia/problem-details
Add docs on generating ProblemDetails payloadpull/22625/head
commit
4c448c256f
|
@ -329,3 +329,8 @@ Use the <xref:Microsoft.AspNetCore.Mvc.ApiBehaviorOptions.ClientErrorMapping%2A>
|
|||
## Custom Middleware to handle exceptions
|
||||
|
||||
The defaults in the exception handling middleware works well for most apps. For apps that require specialized exception handling, consider [customizing the exception handling middleware](xref:fundamentals/error-handling#exception-handler-lambda).
|
||||
|
||||
### Producing a ProblemDetails payload for exceptions
|
||||
|
||||
ASP.NET Core doesn't produce a standardized error payload when the server encounters an unhandled exception. For scenarios where it is desireable to return a standardized [ProblemDetails response](https://datatracker.ietf.org/doc/html/rfc7807) to the client, the [ProblemDetails middleware](https://www.nuget.org/packages/Hellang.Middleware.ProblemDetails/) can be used to map exceptions and 404s to a [ProblemDetails](xref:web-api/handle-errors#pd) payload. The exception handling middleware can also be used to return a <xref:Microsoft.AspNetCore.Mvc.ProblemDetails> payload for unhandled exceptions.
|
||||
|
||||
|
|
Loading…
Reference in New Issue