pub struct EnhancedError {
pub error: ErrorKind,
pub file_path: Option<String>,
pub line: Option<usize>,
pub column: Option<usize>,
pub source_line: Option<String>,
pub suggestion: Option<String>,
pub notes: Vec<String>,
}Expand description
Enhanced error with source location and context
Fields§
§error: ErrorKindThe base error
file_path: Option<String>Source file path
line: Option<usize>Line number (1-indexed)
column: Option<usize>Column number (1-indexed)
source_line: Option<String>The source line containing the error
suggestion: Option<String>Helpful suggestion for fixing the error
notes: Vec<String>Related information
Implementations§
Source§impl EnhancedError
impl EnhancedError
pub fn new(error: ErrorKind) -> EnhancedError
pub fn with_location( self, file: &str, line: usize, column: usize, ) -> EnhancedError
pub fn with_source_line(self, line: &str) -> EnhancedError
pub fn with_suggestion(self, suggestion: &str) -> EnhancedError
pub fn add_note(self, note: &str) -> EnhancedError
Sourcepub fn from_ast_node<T>(
error: ErrorKind,
node: &T,
source: &str,
) -> EnhancedErrorwhere
T: Ranged,
pub fn from_ast_node<T>(
error: ErrorKind,
node: &T,
source: &str,
) -> EnhancedErrorwhere
T: Ranged,
Extract location from AST node
Trait Implementations§
Source§impl Debug for EnhancedError
impl Debug for EnhancedError
Auto Trait Implementations§
impl Freeze for EnhancedError
impl RefUnwindSafe for EnhancedError
impl Send for EnhancedError
impl Sync for EnhancedError
impl Unpin for EnhancedError
impl UnsafeUnpin for EnhancedError
impl UnwindSafe for EnhancedError
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> 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