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.
This overload acts like Func.compose
, but because it composes two SyncFuncs, it doesn't need an ExecutionContext.
Creates a new function composing these two, which is synchronous iff both inputs were synchronous.
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 function is either Func.nop
or Func.nopAsync
.
Returns true iff this is a function built by Func.pass
.
Returns true iff this is a function built by Func.pass
.
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 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.
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.
Suppress all errors matched by the NonFatal extractor.
Alias for compose
.
Alias for compose
. This overload acts like Func.compose
, but because it composes two SyncFuncs, it doesn't need an ExecutionContext.
Alias for compose
.
Alias for compose
. Creates a new function composing these two, which is synchronous iff both inputs were synchronous.
The synchronous case of Func.