throwOut<RT extends Object, ET extends Exception, BET extends Exception> static method

Failure<RT, ET> throwOut<RT extends Object, ET extends Exception, BET extends Exception>(
  1. BET baseException,
  2. Error error, [
  3. Log? log,
  4. Map<String, dynamic> monitorOnError = const {},
])
override

RT...return type
ET...exception type
BET...base exception type

exception を throw out させる syntax sugar.

Implementation

static Failure<RT, ET> throwOut<
    RT extends Object
    ,ET extends Exception
    ,BET extends Exception
>(
    BET baseException,
    Error error,
    [
        Log? log,
        Map<String, dynamic> monitorOnError = const {},
    ]
) {

    switch (baseException) {
        case ET():
            return Failure(baseException, log);
        case _:
            if (log != null) log.monitor(monitorOnError);
            Result.panic(error, log);
    }

}