Module error

error

Standard error handling types and traits for Yo.

Types

AnyError type-alias
AnyError

Type-erased dynamic error type. Wraps any type implementing Error.

Exception struct
Exception

Non-resumable exception handling effect record. Use throw to raise an AnyError and abort the current computation. throw is ctl(...) — handler body may contain unwind, and the handler value is frame-bound (see plans/EXPLICIT_EFFECTS.md §4).

Fields

NameTypeDescription
throw(Exception) ctl(forall(comptime(ResumeType) : Type), error : AnyError) -> ResumeType
ResumableException type-function
fn(comptime(ResumeType) : Type) -> (comptime(fn_return_yo8c454b41_id_87) : Type)

Creates a resumable exception effect record parameterized by the resume type. Unlike Exception, the handler can return a value to resume the computation. throw is still ctl(...) because the handler MAY choose to unwind; regular fn returns are also valid via subtyping fn <: ctl.

Type Parameters

NameTypeNotes
ResumeTypeTypecomptime
IoExn struct
IoExn

Common effect bundle: Io + Exception. Used as the effect parameter for Futures that perform Io and may throw. Construct with { io, exn }; project with e.io or e.exn.

Fields

NameTypeDescription
ioIo
exnException

Traits / Modules

Error trait
Error

Standard error trait for typed error propagation. All error types should implement this trait along with ToString.

Methods

source : fn(self : Self) -> Option(Dyn(trait((() : Type(1)) = Runtime(id: "Runtime")), ToString))

Parameters

NameTypeNotes
selfSelf

Returns: Option(Dyn(trait((() : Type(1)) = Runtime(id: "Runtime")), ToString))

Implementors