Skip to content

Commit

Permalink
Use throwable for tryDeserialise. (airbytehq#8631)
Browse files Browse the repository at this point in the history
  • Loading branch information
davinchia authored and schlattk committed Jan 4, 2022
1 parent 2d849ac commit 62f1df6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ public static JsonNode deserialize(final String jsonString) {
public static <T> Optional<T> tryDeserialize(final String jsonString, final Class<T> klass) {
try {
return Optional.of(OBJECT_MAPPER.readValue(jsonString, klass));
} catch (final IOException e) {
} catch (final Throwable e) {
return Optional.empty();
}
}

public static Optional<JsonNode> tryDeserialize(final String jsonString) {
try {
return Optional.of(OBJECT_MAPPER.readTree(jsonString));
} catch (final IOException e) {
} catch (final Throwable e) {
return Optional.empty();
}
}
Expand Down

0 comments on commit 62f1df6

Please sign in to comment.