proudmonkey / AutoWrapper

A simple, yet customizable global exception handler and Http response wrapper for ASP.NET Core APIs.
MIT License
679 stars 82 forks source link

How to use Custom Response Schema while working with Clean Architecture #137

Open sabkaraja opened 2 years ago

sabkaraja commented 2 years ago

Hi I am using https://github.com/jasontaylordev/CleanArchitecture which has an ApiExceptionFilterAttribute that trapped my Validation Exceptions (and errors dictionary).

After enabling AutoWrapper, all I get is a generic { "message": "One or more validation failures have occurred." }

My business logic is in the Application project. The FluentValidations throw the validation errors which are caught by ValidationBehavior & raise as ValidationException. I saw some of the AutoWrapperOptions to use UseCustomExceptionFormat & CustomSchema. Does it allow me to catch the ValidationException

How do I get AutoWrapper to return message, error dictionary & statusCode?