dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.23k stars 9.95k forks source link

Native support for rfc7807 api error handling and messages #33342

Closed soaringindian closed 3 years ago

soaringindian commented 3 years ago

Recommend that aspnetcore api error handling be enhanced to align with RFC7807. Details of specific errors passed back to clients in json format. https://tools.ietf.org/rfc/rfc7807.txt

There are several c# libraries on GitHub that implement RFC7807 as middle ware. I believe the community as a whole would benefit from support for RFC78107 being baked directly into aspnetcore.

A few middleware options https://github.com/lvermeulen/HttpProblemDetails https://github.com/DeLoachAero/RFC7807ErrorMessages

pranavkm commented 3 years ago

FYI @captainsafia

captainsafia commented 3 years ago

Thanks for sharing your scenario, @soaringindian. We're planning on doing some work to handle returning he correct ProblemDetails error JSON for 500/404 errors as outlined in https://github.com/dotnet/aspnetcore/issues/4953.

Are there other scenarios not covered in the issue above that you'd like to call out?