public static < T > Supplier < T > recover ( Supplier < T > supplier , Function < Exception , T > exceptionHandler ) { return ( ) -> { try { return supplier . get ( ) ; } catch ( Exception exception ) { return exceptionHandler . apply ( exception ) ; } } ; }
Returns a composed function that first executes the Supplier and optionally recovers from an exception .