- Prelude
- @catch <A> (Error error, Func<Error, A> Fail)
- @catch (Error error, Func<Error, Error> Fail)
- @catch <A> (Error error, A Fail)
- @catch (Error error, Error Fail)
- @catch <A> (int errorCode, Func<Error, A> Fail)
- @catch (int errorCode, Func<Error, Error> Fail)
- @catch <A> (int errorCode, A Fail)
- @catch (int errorCode, Error Fail)
- @catch <A> (string errorText, Func<Error, A> Fail)
- @catch (string errorText, Func<Error, Error> Fail)
- @catch <A> (string errorText, A Fail)
- @catch (string errorText, Error Fail)
- @catch <A> (Func<Exception, bool> predicate, Func<Exception, A> Fail)
- @catch (Func<Exception, bool> predicate, Func<Exception, Error> Fail)
- @catch <A> (Func<Exception, bool> predicate, A Fail)
- @catch (Func<Exception, bool> predicate, Error Fail)
- @catch (Error Fail)
- @catch <A> (A Fail)
- @catchOf <E, A> (Func<E, A> Fail)
- @catchOf <E> (Func<E, Error> Fail)
- @expected <A> (Func<Expected, A> Fail)
- @expected (Func<Expected, Error> Fail)
- @expectedOf <E, A> (Func<E, A> Fail)
- @expectedOf <E> (Func<E, Error> Fail)
- @exceptional <A> (Func<Exceptional, A> Fail)
- @exceptional (Func<Exceptional, Error> Fail)
- @exceptionalOf <E, A> (Func<E, A> Fail)
- @exceptionalOf <E> (Func<E, Error> Fail)
The @catch
functions produce a CatchError
or CatchValue
type. These can be composed together with the
Aff
and Eff
monads (and maybe more in the future), to create a functional-programming equivalent to
exception catching and matching.
public class TimeoutExample<RT>
where RT : struct,
HasTime<RT>,
HasCancel<RT>,
HasConsole<RT>
{
public static Aff<RT, Unit> main =>
from _1 in timeout(60 * seconds, longRunning)
| @catch(Errors.TimedOut, unit)
from _2 in Console<RT>.writeLine("done")
select unit;
static Aff<RT, Unit> longRunning =>
(from tm in Time<RT>.now
from _1 in Console<RT>.writeLine(tm.ToLongTimeString())
select unit)
.ToAff()
.Repeat(Schedule.Fibonacci(1 * second));
}
method CatchValue<A> @catch <A> (Error error, Func<Error, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchError @catch (Error error, Func<Error, Error> Fail) Source #
Catch an error if the error matches the argument provided
method CatchValue<A> @catch <A> (Error error, A Fail) Source #
Catch an error if the error matches the argument provided
method CatchError @catch (Error error, Error Fail) Source #
Catch an error if the error matches the argument provided
method CatchValue<A> @catch <A> (int errorCode, Func<Error, A> Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchError @catch (int errorCode, Func<Error, Error> Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchValue<A> @catch <A> (int errorCode, A Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchError @catch (int errorCode, Error Fail) Source #
Catch an error if the error Code
matches the errorCode
argument provided
method CatchValue<A> @catch <A> (string errorText, Func<Error, A> Fail) Source #
Catch an error if the error message matches the errorText
argument provided
method CatchError @catch (string errorText, Func<Error, Error> Fail) Source #
Catch an error if the error message matches the errorText
argument provided
method CatchValue<A> @catch <A> (string errorText, A Fail) Source #
Catch an error if the error message matches the errorText
argument provided
method CatchError @catch (string errorText, Error Fail) Source #
Catch an error if the error message matches the errorText
argument provided
method CatchValue<A> @catch <A> (Func<Exception, bool> predicate, Func<Exception, A> Fail) Source #
Catch an error if it's of a specific exception type
method CatchError @catch (Func<Exception, bool> predicate, Func<Exception, Error> Fail) Source #
Catch an error if it's of a specific exception type
method CatchValue<A> @catch <A> (Func<Exception, bool> predicate, A Fail) Source #
Catch an error if it's of a specific exception type
method CatchError @catch (Func<Exception, bool> predicate, Error Fail) Source #
Catch an error if it's of a specific exception type
method CatchValue<A> @expectedOf <E, A> (Func<E, A> Fail) Source #
Catch expected errors
method CatchError @expectedOf <E> (Func<E, Error> Fail) Source #
Catch expected errors
method CatchValue<A> @exceptional <A> (Func<Exceptional, A> Fail) Source #
Catch exceptional errors
method CatchError @exceptional (Func<Exceptional, Error> Fail) Source #
Catch exceptional errors
method CatchValue<A> @exceptionalOf <E, A> (Func<E, A> Fail) Source #
Catch exceptional errors
method CatchError @exceptionalOf <E> (Func<E, Error> Fail) Source #
Catch exceptional errors