Repository navigation
4.5.11.1 - better error reporting from Request.getBodyAs()
Body processing helper Request.getBodyAs() throws an "unchecked" BadRequest error if Vert.x Jackson integration throws a DecodeException when trying to decode the request body as an application/json content-type. The error message was simply the Jackson exception message - that was both needlessly details and also not readable by humans who haven't dealt directly with Jackson in the past.
This patch adds a helper Jackson parsing utility class JsonDecodingExceptionFormatter that knows how to format (some) Jackson errors in a way that is friendlier to REST API consumers; Request.getBodyAs() now uses this helper to create its BadRequest error message (so it is nicer when handled automatically through Request.handleFailure()), and also sets the original DecodeException as the cause for the BadRequest so it can be parse manually if needed.