Skip to main content

PythonExceptions

Struct PythonExceptions 

Source
pub struct PythonExceptions { /* private fields */ }
Expand description

Python exception heap, class policy, chaining, grouping, and handler matching.

Implementations§

Source§

impl PythonExceptions

Source

pub fn new(max_objects: usize) -> Result<Self, PythonExceptionError>

Construct a bounded Python exception heap.

Source

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.

Source

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.

Source

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.

Source

pub fn set_cause( &mut self, error: PythonExceptionRef, cause: PythonExceptionRef, ) -> Result<(), PythonExceptionError>

Attach an explicit cause and apply Python’s context-suppression rule.

Source

pub fn set_context( &mut self, error: PythonExceptionRef, context: PythonExceptionRef, ) -> Result<(), PythonExceptionError>

Attach the exception active when another exception was raised.

Source

pub fn raise( &self, cx: &Cx, error: PythonExceptionRef, ) -> Result<Raised, PythonExceptionError>

Convert a managed Python exception to the shared exceptional-completion envelope.

Source

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.

Source

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.

Source

pub fn inspect( &self, error: PythonExceptionRef, ) -> Result<&PythonExceptionData, PythonExceptionError>

Return the immutable Python payload for diagnostics and policy checks.

Source

pub fn relations( &self, error: PythonExceptionRef, ) -> Result<Vec<(PythonExceptionRelation, PythonExceptionRef)>, PythonExceptionError>

Return ordered typed relations for diagnostics and subgroup derivation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.