pub struct Stack {
pub exc_type: String,
pub exc_value: String,
pub syntax_error: Option<SyntaxErrorInfo>,
pub is_cause: bool,
pub frames: Vec<Frame>,
}Expand description
A single exception stack (one exception in a chain).
Contains the exception type, value, optional syntax error info, and the list of frames leading to the exception.
Fields§
§exc_type: StringThe exception type name (e.g., “ValueError”, “RuntimeError”).
exc_value: StringThe exception message/value.
syntax_error: Option<SyntaxErrorInfo>Syntax error information (for SyntaxError exceptions).
is_cause: boolWhether this exception was caused by another (chained exception).
frames: Vec<Frame>The stack frames for this exception.
Implementations§
Source§impl Stack
impl Stack
Sourcepub fn with_syntax_error(self, error: SyntaxErrorInfo) -> Self
pub fn with_syntax_error(self, error: SyntaxErrorInfo) -> Self
Set the syntax error info.
Sourcepub fn with_is_cause(self, is_cause: bool) -> Self
pub fn with_is_cause(self, is_cause: bool) -> Self
Mark this as a caused exception (from exception chaining).
Sourcepub fn with_frames(self, frames: Vec<Frame>) -> Self
pub fn with_frames(self, frames: Vec<Frame>) -> Self
Set the frames for this stack.
Sourcepub fn with_frame(self, frame: Frame) -> Self
pub fn with_frame(self, frame: Frame) -> Self
Add a single frame to the stack.
Sourcepub fn is_syntax_error(&self) -> bool
pub fn is_syntax_error(&self) -> bool
Check if this is a syntax error.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Get the number of frames.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnwindSafe for Stack
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more