@ SneakyThrows public static < T , R > Function < T , R > doAndHandle ( final CheckedFunction < T , R > function , final CheckedFunction < Throwable , R > errorHandler ) { return t -> { try { return function . apply ( t ) ; } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; try { return errorHandler . apply ( e ) ; } catch ( final Throwable ex ) { throw new IllegalArgumentException ( ex . getMessage ( ) ) ; } } } ; }
Default function function .