pub enum Error {
Parse {
message: String,
line: usize,
col: usize,
snippet: Option<String>,
help: Option<String>,
},
UnexpectedEof {
expected: String,
line: usize,
},
InvalidDirective {
name: String,
reason: Option<String>,
suggestion: Option<String>,
},
InvalidArgument {
directive: String,
message: String,
expected: Option<String>,
},
Syntax {
message: String,
line: usize,
col: usize,
expected: Option<String>,
found: Option<String>,
},
Io(Error),
System(String),
Serialization(String),
Include(String),
Custom(String),
}Expand description
Main error type with enhanced diagnostics
Variants§
Parse
Error during parsing with detailed context
Fields
UnexpectedEof
Unexpected end of input while parsing
InvalidDirective
Invalid directive name or usage
Fields
InvalidArgument
Invalid argument for a directive
Fields
Syntax
Syntax error with context
Fields
Io(Error)
IO error
System(String)
Available on crate feature
system only.System error (nginx not found, etc.)
Serialization(String)
Available on crate feature
serde only.Serialization error
Include(String)
Available on crate feature
includes only.Include resolution error
Custom(String)
Custom error
Implementations§
Source§impl Error
impl Error
Sourcepub fn parse(message: impl Into<String>, line: usize, col: usize) -> Self
pub fn parse(message: impl Into<String>, line: usize, col: usize) -> Self
Create a new parse error with helpful context
Sourcepub fn parse_with_context(
message: impl Into<String>,
line: usize,
col: usize,
snippet: impl Into<String>,
help: impl Into<String>,
) -> Self
pub fn parse_with_context( message: impl Into<String>, line: usize, col: usize, snippet: impl Into<String>, help: impl Into<String>, ) -> Self
Create a parse error with source snippet and help text
Sourcepub fn unexpected_eof(expected: impl Into<String>, line: usize) -> Self
pub fn unexpected_eof(expected: impl Into<String>, line: usize) -> Self
Create an unexpected EOF error
Sourcepub fn syntax(
message: impl Into<String>,
line: usize,
col: usize,
expected: Option<String>,
found: Option<String>,
) -> Self
pub fn syntax( message: impl Into<String>, line: usize, col: usize, expected: Option<String>, found: Option<String>, ) -> Self
Create a syntax error with expected/found information
Sourcepub fn invalid_directive(
name: impl Into<String>,
reason: Option<String>,
suggestion: Option<String>,
) -> Self
pub fn invalid_directive( name: impl Into<String>, reason: Option<String>, suggestion: Option<String>, ) -> Self
Create an invalid directive error with suggestion
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin 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
Mutably borrows from an owned value. Read more
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