Best way to manage parameters error RRS feed

  • Question

  • User-930352495 posted


    I'm working on refactor for some web API, I have a controller that receives some parameters, this controller sends everything to a service that has access to db, normally the service returns a collection of items or an empty list, here now I check that the parameters are in some table, if there are, I can continue the execution, if I can't find them I have to go back and notify.

    Here I would like to know what can be the best way to manage, I had thought of returning some (custom?) exceptions to the controller and the latter should be returning a bad request, but I am not convinced, the other way may be to return and object with a list of items originally returned by the service with some other flag reporting the error.

    In this case, I have to do a lot of refactoring work.

    What do you think is the best way to manage this scenario?

    Many thanks for the help.

    Tuesday, April 21, 2020 3:54 PM

All replies