pub enum Error {
Show 14 variants
Parse {
position: Position,
message: String,
context: Option<ErrorContext>,
},
Scan {
position: Position,
message: String,
context: Option<ErrorContext>,
},
Construction {
position: Position,
message: String,
context: Option<ErrorContext>,
},
Emission {
message: String,
},
Io {
kind: ErrorKind,
message: String,
},
Utf8 {
message: String,
},
Type {
expected: String,
found: String,
position: Position,
context: Option<ErrorContext>,
},
Value {
position: Position,
message: String,
context: Option<ErrorContext>,
},
Config {
message: String,
},
Multiple {
errors: Vec<Error>,
message: String,
},
LimitExceeded {
message: String,
},
Indentation {
position: Position,
expected: usize,
found: usize,
context: Option<ErrorContext>,
},
InvalidCharacter {
position: Position,
character: char,
context_description: String,
context: Option<ErrorContext>,
},
UnclosedDelimiter {
start_position: Position,
current_position: Position,
delimiter_type: String,
context: Option<ErrorContext>,
},
}Expand description
Comprehensive error type for YAML processing
Variants§
Parse
Parsing errors with position information
Fields
context: Option<ErrorContext>Additional context for better error reporting
Scan
Scanning errors during tokenization
Fields
context: Option<ErrorContext>Additional context for better error reporting
Construction
Construction errors when building objects
Fields
context: Option<ErrorContext>Additional context for better error reporting
Emission
Emission errors during output generation
Io
IO errors (simplified for clonability)
Utf8
UTF-8 encoding errors
Type
Type conversion errors
Fields
context: Option<ErrorContext>Additional context for better error reporting
Value
Value errors for invalid values
Fields
context: Option<ErrorContext>Additional context for better error reporting
Config
Configuration errors
Multiple
Multiple related errors
LimitExceeded
Resource limit exceeded
Indentation
Indentation errors
Fields
context: Option<ErrorContext>Additional context
InvalidCharacter
Invalid character or sequence
Fields
context: Option<ErrorContext>Additional context
UnclosedDelimiter
Unclosed delimiter (quote, bracket, etc.)
Implementations§
Source§impl Error
impl Error
Sourcepub fn parse_with_context(
position: Position,
message: impl Into<String>,
context: ErrorContext,
) -> Self
pub fn parse_with_context( position: Position, message: impl Into<String>, context: ErrorContext, ) -> Self
Create a new parse error with context
Sourcepub fn scan_with_context(
position: Position,
message: impl Into<String>,
context: ErrorContext,
) -> Self
pub fn scan_with_context( position: Position, message: impl Into<String>, context: ErrorContext, ) -> Self
Create a new scan error with context
Sourcepub fn construction(position: Position, message: impl Into<String>) -> Self
pub fn construction(position: Position, message: impl Into<String>) -> Self
Create a new construction error
Sourcepub fn construction_with_context(
position: Position,
message: impl Into<String>,
context: ErrorContext,
) -> Self
pub fn construction_with_context( position: Position, message: impl Into<String>, context: ErrorContext, ) -> Self
Create a new construction error with context
Sourcepub fn limit_exceeded(message: impl Into<String>) -> Self
pub fn limit_exceeded(message: impl Into<String>) -> Self
Create a new limit exceeded error
Sourcepub fn type_error(
position: Position,
expected: impl Into<String>,
found: impl Into<String>,
) -> Self
pub fn type_error( position: Position, expected: impl Into<String>, found: impl Into<String>, ) -> Self
Create a new type error
Sourcepub fn type_error_with_context(
position: Position,
expected: impl Into<String>,
found: impl Into<String>,
context: ErrorContext,
) -> Self
pub fn type_error_with_context( position: Position, expected: impl Into<String>, found: impl Into<String>, context: ErrorContext, ) -> Self
Create a new type error with context
Sourcepub fn value_error(position: Position, message: impl Into<String>) -> Self
pub fn value_error(position: Position, message: impl Into<String>) -> Self
Create a new value error
Sourcepub fn value_error_with_context(
position: Position,
message: impl Into<String>,
context: ErrorContext,
) -> Self
pub fn value_error_with_context( position: Position, message: impl Into<String>, context: ErrorContext, ) -> Self
Create a new value error with context
Sourcepub fn config_error(message: impl Into<String>) -> Self
pub fn config_error(message: impl Into<String>) -> Self
Create a new configuration error
Sourcepub fn multiple(errors: Vec<Self>, message: impl Into<String>) -> Self
pub fn multiple(errors: Vec<Self>, message: impl Into<String>) -> Self
Create a multiple error with related errors
Sourcepub const fn indentation(
position: Position,
expected: usize,
found: usize,
) -> Self
pub const fn indentation( position: Position, expected: usize, found: usize, ) -> Self
Create an indentation error
Sourcepub const fn indentation_with_context(
position: Position,
expected: usize,
found: usize,
context: ErrorContext,
) -> Self
pub const fn indentation_with_context( position: Position, expected: usize, found: usize, context: ErrorContext, ) -> Self
Create an indentation error with context
Sourcepub fn invalid_character(
position: Position,
character: char,
context_description: impl Into<String>,
) -> Self
pub fn invalid_character( position: Position, character: char, context_description: impl Into<String>, ) -> Self
Create an invalid character error
Sourcepub fn invalid_character_with_context(
position: Position,
character: char,
context_description: impl Into<String>,
context: ErrorContext,
) -> Self
pub fn invalid_character_with_context( position: Position, character: char, context_description: impl Into<String>, context: ErrorContext, ) -> Self
Create an invalid character error with context
Sourcepub fn unclosed_delimiter(
start_position: Position,
current_position: Position,
delimiter_type: impl Into<String>,
) -> Self
pub fn unclosed_delimiter( start_position: Position, current_position: Position, delimiter_type: impl Into<String>, ) -> Self
Create an unclosed delimiter error
Sourcepub fn unclosed_delimiter_with_context(
start_position: Position,
current_position: Position,
delimiter_type: impl Into<String>,
context: ErrorContext,
) -> Self
pub fn unclosed_delimiter_with_context( start_position: Position, current_position: Position, delimiter_type: impl Into<String>, context: ErrorContext, ) -> Self
Create an unclosed delimiter error with context
Sourcepub const fn position(&self) -> Option<&Position>
pub const fn position(&self) -> Option<&Position>
Get the position associated with this error, if any
Sourcepub const fn context(&self) -> Option<&ErrorContext>
pub const fn context(&self) -> Option<&ErrorContext>
Get the context associated with this error, if any
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl Error for Error
impl Error for Error
Source§fn custom<T: Display>(msg: T) -> Self
fn custom<T: Display>(msg: T) -> Self
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Deserialize struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize struct type received more than one of the
same field.Source§impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
Source§fn from(err: FromUtf8Error) -> Self
fn from(err: FromUtf8Error) -> Self
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.