baml.errors.Context
The temporal context of a thrown error: the error value itself, where it was thrown, and the error it superseded while the scope was unwinding (its `cause`), if any. Bound by the second parameter of a `catch (e, ctx)` handler.
Signature
class baml.errors.ContextThe temporal context of a thrown error: the error value itself, where it
was thrown, and the error it superseded while the scope was unwinding (its
cause), if any. Bound by the second parameter of a catch (e, ctx)
handler.
The chain runs newest → oldest through cause; root_cause walks to the
original failure at the tail, and to_string renders the whole chain
Python-style ("During handling of the above error, another error occurred").
Source:<builtin>/baml/ns_errors/error_context.bamlbytes 482–1137
Fields
Instance methods
_to_string_impl
(self) -> string throws neverroot_cause
(self) -> baml.errors.Context throws neverThe original error at the tail of the cause chain — walks cause to the
deepest link. Returns self when nothing was superseded.
Implementations
baml.Concrete for T
Source:<builtin>/baml/core.bamlbytes 763–795
baml.ToString for baml.errors.Context
Instance methods
to_string
(self) -> string throws neverSource:<builtin>/baml/ns_errors/error_context.bamlbytes 896–1031