jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core
MIT License
16.75k stars 3.6k forks source link

Internal server error if a invalid parameter is sent on the route #1191

Open alamadorm opened 3 months ago

alamadorm commented 3 months ago

Describe the bug If i have an endpoint todo/:id in wich de id is int and i send an string is causing an internal server error, it should respond with a bad request. To fix this I handled the exception in the exception Handler, but for some reason, if the ASPNETCORE_ENVIROMENT is set to Production there is not detail in the response, otherwise is returning the details on the response.

To Reproduce Steps to reproduce the behavior:

  1. Call the [PUT] /api/TodoItems/{id} endpoint with an string intead of a integer

Expected behavior It should return a bad request