Skip to content

Commit

Permalink
Changed to RuntimeException
Browse files Browse the repository at this point in the history
  • Loading branch information
vaisakhkannan committed Nov 7, 2024
1 parent 3255846 commit d5a1c00
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ExceptionUtil {
* @param <T> the type of result expected from the action
* @return the result of the action or the fallback value in case of an exception
*/
public static <T> T executeWithExceptionHandling(Supplier<T> action, Function<Exception, T> fallback) {
public static <T> T executeWithExceptionHandling(Supplier<T> action, Function<RuntimeException, T> fallback) {
try {
return action.get();
} catch (ProcessCanceledException e) {
Expand All @@ -45,7 +45,7 @@ public static <T> T executeWithExceptionHandling(Supplier<T> action, Function<Ex
throw e;
} catch (IndexNotReadyException | CancellationException e) {
throw e;
} catch (Exception e) {
} catch (RuntimeException e) {
// Invoke the fallback function with the exception to generate a safe return value.
return fallback.apply(e);
}
Expand Down

0 comments on commit d5a1c00

Please sign in to comment.