-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InvalidValueException doesn't help resolving issues #2845
Comments
Related to this issue - the public class FromMapConverter implements Converter {
private static final ObjectMapper MAPPER = new ObjectMapper(); Do you have any plans for either using Spring Boot |
Can you add the Elide annotations to the example model or provide a working example based on Elide-spring-boot of the issue? |
Apologies for the late reply, but I've updated my main comment's example with the same annotations that I use. |
Hi @aklish, have you had the time to look at this issue? For now, I've implemented my custom private InvalidValueException getchangedInvalidValueException(Exception exception) {
InvalidValueException invalidValueException = (InvalidValueException) exception;
if (StringUtils.isEmpty(invalidValueException.getVerboseMessage())) {
return invalidValueException;
}
return new InvalidValueException(invalidValueException.getVerboseMessage().replace("Invalid value: ", ""), invalidValueException.getVerboseMessage());
} |
Expected Behaviour
When a field receives an invalid value, return the error for it:
Current Behavior
Currently, the error message is very "cryptic" - it's impossible to tell what went wrong, which field was sent an invalid value. I will give you an example in
Steps to Reproduce
, but here's is the response I receive when a single or multiple values are invalid:Possible Solution
An improvement, in my opinion, would be to either show an error for the first field that fails and has an error, or even better - gather all fields with errors and list them in the response.
Steps to Reproduce (for bugs)
Here is a simple example class:
So if I send a request like this:
The error response for the invalid field will be:
Your Environment
The text was updated successfully, but these errors were encountered: