Class o2.Try
static
class
o2.Try
Executes all the given delegates one by one.
If an exception occurs while executing the argument, the next one will be tried.
Usage example:
o2.Try.all(fn1, fn2, fn3);
Tries all the given delegates, will stop at the first successful execution.
If an exception occurs while executing the argument, the next one will be tried.
But after the first successful execution, with no error, no further functions will be executed.
Usage example:
o2.Try.these(fn1, fn2, fn3);
Function Details
function all
static
all(Arguments
...)
Executes all the given delegates one by one.
If an exception occurs while executing the argument, the next one will be tried.
Usage example:
o2.Try.all(fn1, fn2, fn3);
...
- each argument as a function. function these
static
these(Arguments
...)
Tries all the given delegates, will stop at the first successful execution.
If an exception occurs while executing the argument, the next one will be tried.
But after the first successful execution, with no error, no further functions will be executed.
Usage example:
o2.Try.these(fn1, fn2, fn3);
...
- each argument as a function.
Used for consequentially executing a set of
Function
s.The functions are guaranteed to be called.
Even if an error occurs when calling a
Function
, the nextFunction
will be tried, disregarding the error.