pub struct PythonExceptions { /* private fields */ }Expand description
Python exception heap, class policy, chaining, grouping, and handler matching.
Implementations§
Source§impl PythonExceptions
impl PythonExceptions
Sourcepub fn new(max_objects: usize) -> Result<Self, PythonExceptionError>
pub fn new(max_objects: usize) -> Result<Self, PythonExceptionError>
Construct a bounded Python exception heap.
Sourcepub fn define_class(
&mut self,
cx: &Cx,
class: ClassRef,
bases: Vec<ClassRef>,
) -> Result<(), ClassError>
pub fn define_class( &mut self, cx: &Cx, class: ClassRef, bases: Vec<ClassRef>, ) -> Result<(), ClassError>
Declare an exception class through the Python class system delivered by CLASS_2.
Sourcepub fn allocate(
&mut self,
class: ClassRef,
message: impl Into<String>,
origin: Origin,
) -> Result<PythonExceptionRef, PythonExceptionError>
pub fn allocate( &mut self, class: ClassRef, message: impl Into<String>, origin: Origin, ) -> Result<PythonExceptionRef, PythonExceptionError>
Allocate an ordinary exception object with exact traceback origin.
Sourcepub fn group(
&mut self,
class: ClassRef,
message: impl Into<String>,
members: &[PythonExceptionRef],
origin: Origin,
) -> Result<PythonExceptionRef, PythonExceptionError>
pub fn group( &mut self, class: ClassRef, message: impl Into<String>, members: &[PythonExceptionRef], origin: Origin, ) -> Result<PythonExceptionRef, PythonExceptionError>
Allocate a non-empty exception group and retain members in source order.
Sourcepub fn set_cause(
&mut self,
error: PythonExceptionRef,
cause: PythonExceptionRef,
) -> Result<(), PythonExceptionError>
pub fn set_cause( &mut self, error: PythonExceptionRef, cause: PythonExceptionRef, ) -> Result<(), PythonExceptionError>
Attach an explicit cause and apply Python’s context-suppression rule.
Sourcepub fn set_context(
&mut self,
error: PythonExceptionRef,
context: PythonExceptionRef,
) -> Result<(), PythonExceptionError>
pub fn set_context( &mut self, error: PythonExceptionRef, context: PythonExceptionRef, ) -> Result<(), PythonExceptionError>
Attach the exception active when another exception was raised.
Sourcepub fn raise(
&self,
cx: &Cx,
error: PythonExceptionRef,
) -> Result<Raised, PythonExceptionError>
pub fn raise( &self, cx: &Cx, error: PythonExceptionRef, ) -> Result<Raised, PythonExceptionError>
Convert a managed Python exception to the shared exceptional-completion envelope.
Sourcepub fn matches(
&self,
cx: &mut Cx,
raised: &Raised,
candidate: ClassRef,
budget: ClassMatchBudget,
) -> ClassMatchOutcome
pub fn matches( &self, cx: &mut Cx, raised: &Raised, candidate: ClassRef, budget: ClassMatchBudget, ) -> ClassMatchOutcome
Match a raised completion using bounded class evidence and Python predicate policy.
Sourcepub fn split(
&mut self,
cx: &mut Cx,
group: PythonExceptionRef,
candidate: ClassRef,
budget: ClassMatchBudget,
) -> Result<(Option<PythonExceptionRef>, Option<PythonExceptionRef>), PythonExceptionError>
pub fn split( &mut self, cx: &mut Cx, group: PythonExceptionRef, candidate: ClassRef, budget: ClassMatchBudget, ) -> Result<(Option<PythonExceptionRef>, Option<PythonExceptionRef>), PythonExceptionError>
Split a group by handler class while preserving direct-member order.
Sourcepub fn inspect(
&self,
error: PythonExceptionRef,
) -> Result<&PythonExceptionData, PythonExceptionError>
pub fn inspect( &self, error: PythonExceptionRef, ) -> Result<&PythonExceptionData, PythonExceptionError>
Return the immutable Python payload for diagnostics and policy checks.
Sourcepub fn relations(
&self,
error: PythonExceptionRef,
) -> Result<Vec<(PythonExceptionRelation, PythonExceptionRef)>, PythonExceptionError>
pub fn relations( &self, error: PythonExceptionRef, ) -> Result<Vec<(PythonExceptionRelation, PythonExceptionRef)>, PythonExceptionError>
Return ordered typed relations for diagnostics and subgroup derivation.