So my task is to handle request without or with incorrect query parameters.
The correct one that return data GET {url}/v1/transactions/?from=2017-01-01&to=2035-12-01¤cy=EUR
The request without query parameters GET {url}/v1/transactions/
The request with incorrect query parameter GET {url}/v1/transactions/?from=2017-01-01&to=2035-12-01&currrrrrrrrrrency=EUR
The first one result in HTTP-200
, the last two with HTTP-500 System Error
. It should be HTTP-400
or some another 4xx for incorrect query parameters. Should I add exceptionHandler
for some kind of exception(as it worked before with incorrect content-type etc)? If yes, what kind of exception is thrown when no parameters or invalid are found? Or if there is no such exception, I believe I need to add some validation in my controller. I think the problem would be solved by adding defaultValues, but what if I don't have default values, what do I do to prevent this issue from happening or how could I handle it in another way than http-500.