Skip to content

Commit

Permalink
Preserve cause of Jackson encoding exception when using Vert.x
Browse files Browse the repository at this point in the history
Relates to: quarkusio#20490
  • Loading branch information
geoand committed Oct 1, 2021
1 parent d677f28 commit 4edeed7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public String toString(Object object, boolean pretty) throws EncodeException {
ObjectMapper mapper = pretty ? prettyMapper() : QuarkusJacksonJsonCodec.mapper;
return mapper.writeValueAsString(object);
} catch (Exception e) {
throw new EncodeException("Failed to encode as JSON: " + e.getMessage());
throw new EncodeException("Failed to encode as JSON: " + e.getMessage(), e);
}
}

Expand All @@ -154,7 +154,7 @@ public Buffer toBuffer(Object object, boolean pretty) throws EncodeException {
ObjectMapper mapper = pretty ? prettyMapper() : QuarkusJacksonJsonCodec.mapper;
return Buffer.buffer(mapper.writeValueAsBytes(object));
} catch (Exception e) {
throw new EncodeException("Failed to encode as JSON: " + e.getMessage());
throw new EncodeException("Failed to encode as JSON: " + e.getMessage(), e);
}
}

Expand Down

0 comments on commit 4edeed7

Please sign in to comment.