Static methods
staticattempt<D, F>(f:() ‑> D, report:Dynamic ‑> F):Outcome<D, F>
Try to run f
and wraps the result in Success
,
* thrown exceptions are transformed by report
then wrapped into a Failure
staticflatMap<DIn, FIn, DOut, FOut>(o:Outcome<DIn, FIn>, mapper:OutcomeMapper<DIn, FIn, DOut, FOut>):Outcome<DOut, FOut>
Transforms the outcome with a transform function
* Different from map
, the transform function of flatMap
returns an Outcome
staticmap<A, B, F>(outcome:Outcome<A, F>, transform:A ‑> B):Outcome<B, F>
Transforms the outcome with a transform function
* Different from flatMap
, the transform function of map
returns a plain value
staticor<D, F>(outcome:Outcome<D, F>, fallback:Lazy<D>):D
Extracts the value if the option is Success
, uses the fallback value otherwise
staticorNull<D, F>(outcome:Outcome<D, F>):Null<D>
Extracts the value if the option is Success
, otherwise null
staticorTry<D, F>(outcome:Outcome<D, F>, fallback:Lazy<Outcome<D, F>>):Outcome<D, F>
Extracts the value if the option is Success
, uses the fallback Outcome
otherwise
staticsure<D, F>(outcome:Outcome<D, F>):D
Extracts the value if the outcome is Success
, throws the Failure
contents otherwise