Skip to content

Commit

Permalink
fix regression introduced in #1792
Browse files Browse the repository at this point in the history
* DittoJsonException was not consistently handling `wrapJsonRuntimeException` in different overloaded styles, e.g. the `UnsupportedOperationException` was not catched everywhere
* fixed that

Signed-off-by: Thomas Jäckle <[email protected]>
  • Loading branch information
thjaeckle committed Nov 6, 2023
1 parent ce55fc4 commit fe58303
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ private static URI extractHref(final RuntimeException toWrap) {
public static <I, T> T wrapJsonRuntimeException(final Function<I, T> function, final I input) {
try {
return function.apply(input);
} catch (final JsonRuntimeException | IllegalArgumentException | NullPointerException e) {
} catch (final JsonRuntimeException
| IllegalArgumentException
| NullPointerException
| UnsupportedOperationException e) {
throw new DittoJsonException(e);
}
// "ditto-json" library also throws IllegalArgumentException when for example strings which may not be empty
Expand All @@ -128,9 +131,9 @@ public static <T> T wrapJsonRuntimeException(final Supplier<T> supplier) {
try {
return supplier.get();
} catch (final JsonRuntimeException
| IllegalArgumentException
| NullPointerException
| UnsupportedOperationException e) {
| IllegalArgumentException
| NullPointerException
| UnsupportedOperationException e) {
throw new DittoJsonException(e);
}
// "ditto-json" library also throws IllegalArgumentException when for example strings which may not be empty
Expand All @@ -156,7 +159,10 @@ public static <T, R> R wrapJsonRuntimeException(final T argument, final DittoHea
final BiFunction<T, DittoHeaders, R> function) {
try {
return function.apply(argument, dittoHeaders);
} catch (final JsonRuntimeException | IllegalArgumentException | NullPointerException e) {
} catch (final JsonRuntimeException
| IllegalArgumentException
| NullPointerException
| UnsupportedOperationException e) {
throw new DittoJsonException(e, dittoHeaders);
}
// "ditto-json" library also throws IllegalArgumentException when for example strings which may not be empty
Expand Down

0 comments on commit fe58303

Please sign in to comment.