Result type

Result of a computation

Direct children types

Failure
Failed computation
Success
Successful computation

Constructors

Result(fun:Fun, catch:Any=method) Source: stdlib.ngs:993
Runs the computation and wraps the result: a value is wrapped in Success and an exception matching catch is wrapped in Failure.

Parameters

catchPattern of exceptions to wrap in Failure; other exceptions propagate. Defaults to Exception.

Returns

Success or Failure

Example

{ fetch("conf.json") }.Result(FileIOFail)  # Failure if the file is unreadable; other errors propagate

Methods

ExitCode(r:Result) Source: stdlib.ngs:1097
EXPERIMENTAL! Do not use!
report(tr:TestsResults, group_name:Str, test_name:Str, result:Result, critical:Bool) Source: autoload/globals/TestsResults.ngs:11
Undocumented