Creates a new function composing these two, which is synchronous iff both inputs were synchronous.
Returns true iff this is a SyncFunc
Adds a synchronous recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
Adds a synchronous recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
If this
is a SyncFunc, the result will also be synchronous.
Adds an asynchronous recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
Adds an asynchronous recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
This isn't declared to return an AsyncFunc because it can discard the handler
and return a SyncFunc if the
original function is e.g. nop
or pass
.
Returns either B or a Future[B] depending on the type of this Func.
Suppress all errors matched by the NonFatal extractor.
Suppress all errors matched by the NonFatal extractor. If this
is synchronous, the result is also synchronous.
Shortcut for a cast to AsyncFunc.
Shortcut for a cast to AsyncFunc. Fails at runtime with ClassCastException if this function is synchronous.
Shortcut for a cast to SyncFunc.
Shortcut for a cast to SyncFunc. Fails at runtime with ClassCastException if this function is asynchronous.
Returns a new function that passes any exceptions in the original function to handler
.
Returns a new function that passes any exceptions in the original function to handler
.
The new function still fails with the original exception after the handler
has run.
The returned Func is synchronous iff the original func is synchronous.
Returns true iff this function is either Func.nop
or Func.nopAsync
.
Returns true iff this is a function built by Func.pass
.
Adds a recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
Adds a recovery stage to this function, which handles both synchronously thrown exceptions, and failing futures returned by asynchronous functions.
If this
and handler
are both synchronous, then the result will also be synchronous.
Because the handler
is a Func, it cannot be a partial function; it must handle all NonFatal exceptions.
Exceptions that don't match the NonFatal extractor will not be passed to the handler.
Alias for compose
.
Alias for compose
. Creates a new function composing these two, which is synchronous iff both inputs were synchronous.
Abstracts over synchronous and asynchronous functions. Instances can be composed efficiently, building new synchronous functionsn if all component functions are synchronous.
A func is always either a
SyncFunc
or anAsyncFunc
.