Wrong messageKey and message values when endpoint returns HTTP 400

Description

While I was working on https://openlmis.atlassian.net/browse/OLMIS-6548 I have noticed that for some endpoints, the response error body can be:

The affected endpoints that I have found are (It might be more, I am not sure):

  • POST /users/auth

  • POST Programs, where the code is whitespace or missing

ACC:

  • Every endpoint should return the proper messageKey and message.

Possible solution:
I have found that in some endpoints, where the bindingResults are used, the ValidationMessageException is thrown with:

It would rather be:

To pass the error message key and then the exception handler will get a proper error message for current locale.

Environment

None

Assignee

Unassigned

Reporter

Mateusz Wedeł

Labels

Priority

Major
Configure