crnk-framework icon indicating copy to clipboard operation
crnk-framework copied to clipboard

Invalid date in body results in a 500 error

Open duncanportelli opened this issue 6 years ago • 2 comments

When passing an invalid date in the request body (e.g. "birthDate" : "1992-05-32") a ResourceException is thrown (ResourceUpsert.java:154) because the date cannot be deserialized to a LocalDate. This is handled as a 500 Internal Server error.

Shouldn't this be a 400 Bad Request error?

duncanportelli avatar Dec 04 '18 11:12 duncanportelli

yes, it should, at least a 4xx. PRs always welcome should you already have a fix in mind.

remmeier avatar Dec 04 '18 20:12 remmeier

A crnk built-in ExceptionMapper that catches (certain) JsonProcessingExceptions should do the trick, no?

weaselmetal avatar Feb 26 '20 15:02 weaselmetal