Std.Cause
opaque type Cause[E]The cause of a failure. E is the error set it can fail with.
CauseKind
Section titled “CauseKind”enum CauseKindThe two kinds of causes.
-
FailAn error raised with
fail. Shows up inE. -
DieA defect (
[error.defect]). Does not show up in the type.
fn kind[E](c: Cause[E]) -> CauseKindThe kind of the cause.
to_string
Section titled “to_string”fn to_string[E](c: Cause[E]) -> StringThe cause as text: error: ... or defect: ....
fn raise[A, E](c: Cause[E]) -> A fails ERaises the cause again: Fail fails with the error, and Die is a defect.