pub struct StructuredError {
pub message: String,
pub file_path: Option<String>,
pub line: Option<usize>,
pub column: Option<usize>,
pub error_type: Option<String>,
pub suggestion: Option<String>,
pub stacktrace: Vec<String>,
}Expand description
Structured error information with details and suggestions
Fields§
§message: StringMain error message
file_path: Option<String>File path where the error occurred
line: Option<usize>Line number in the file
column: Option<usize>Column number in the file
error_type: Option<String>Error type/category (e.g., “SyntaxError”, “UnknownStatement”, “RuntimeError”)
suggestion: Option<String>Optional “Did you mean … ?” suggestion
stacktrace: Vec<String>Optional stack trace information
Implementations§
Source§impl StructuredError
impl StructuredError
Sourcepub fn with_location(self, line: usize, column: usize) -> Self
pub fn with_location(self, line: usize, column: usize) -> Self
Set line and column
Sourcepub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
pub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
Set suggestion
Sourcepub fn add_stacktrace(self, entry: impl Into<String>) -> Self
pub fn add_stacktrace(self, entry: impl Into<String>) -> Self
Add a stack trace entry
Sourcepub fn build_details(&self) -> Vec<String>
pub fn build_details(&self) -> Vec<String>
Build the formatted error details for display (old format, kept for compatibility)
Sourcepub fn build_colored_details(&self) -> Vec<(String, String)>
pub fn build_colored_details(&self) -> Vec<(String, String)>
Build the formatted error details for colored display Returns tuples of (label, content) for the logger to format with colors
Trait Implementations§
Source§impl Clone for StructuredError
impl Clone for StructuredError
Source§fn clone(&self) -> StructuredError
fn clone(&self) -> StructuredError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StructuredError
impl RefUnwindSafe for StructuredError
impl Send for StructuredError
impl Sync for StructuredError
impl Unpin for StructuredError
impl UnwindSafe for StructuredError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more