pub struct OakError { /* private fields */ }Expand description
The main error type for the Oak Core parsing framework.
OakError represents all possible language that can occur during
lexical analysis and parsing operations. It provides detailed
error information including error kind and/// precise source location.
Implementations§
Source§impl OakError
impl OakError
Sourcepub fn kind(&self) -> &OakErrorKind
pub fn kind(&self) -> &OakErrorKind
Gets the kind of this error.
Sourcepub fn test_failure(path: PathBuf, expected: String, actual: String) -> OakError
pub fn test_failure(path: PathBuf, expected: String, actual: String) -> OakError
Creates a test failure error.
Sourcepub fn test_regenerated(path: PathBuf) -> OakError
pub fn test_regenerated(path: PathBuf) -> OakError
Creates a test regenerated error.
Sourcepub fn syntax_error(
message: impl Into<String>,
offset: usize,
source_id: Option<u32>,
) -> OakError
pub fn syntax_error( message: impl Into<String>, offset: usize, source_id: Option<u32>, ) -> OakError
Sourcepub fn unexpected_character(
character: char,
offset: usize,
source_id: Option<u32>,
) -> OakError
pub fn unexpected_character( character: char, offset: usize, source_id: Option<u32>, ) -> OakError
Sourcepub fn unexpected_token(
token: impl Into<String>,
offset: usize,
source_id: Option<u32>,
) -> OakError
pub fn unexpected_token( token: impl Into<String>, offset: usize, source_id: Option<u32>, ) -> OakError
Creates an unexpected token error.
Sourcepub fn unexpected_eof(offset: usize, source_id: Option<u32>) -> OakError
pub fn unexpected_eof(offset: usize, source_id: Option<u32>) -> OakError
Creates an unexpected end of file error.
Sourcepub fn expected_token(
expected: impl Into<String>,
offset: usize,
source_id: Option<u32>,
) -> OakError
pub fn expected_token( expected: impl Into<String>, offset: usize, source_id: Option<u32>, ) -> OakError
Creates an expected token error.
Sourcepub fn expected_name(
name_kind: impl Into<String>,
offset: usize,
source_id: Option<u32>,
) -> OakError
pub fn expected_name( name_kind: impl Into<String>, offset: usize, source_id: Option<u32>, ) -> OakError
Creates an expected name error.
Sourcepub fn trailing_comma_not_allowed(
offset: usize,
source_id: Option<u32>,
) -> OakError
pub fn trailing_comma_not_allowed( offset: usize, source_id: Option<u32>, ) -> OakError
Creates a trailing comma not allowed error.
Sourcepub fn custom_error(message: impl Into<String>) -> OakError
pub fn custom_error(message: impl Into<String>) -> OakError
Sourcepub fn invalid_theme(message: impl Into<String>) -> OakError
pub fn invalid_theme(message: impl Into<String>) -> OakError
Creates an invalid theme error.
Sourcepub fn unsupported_format(format: impl Into<String>) -> OakError
pub fn unsupported_format(format: impl Into<String>) -> OakError
Creates an unsupported format error.
Sourcepub fn color_parse_error(color: impl Into<String>) -> OakError
pub fn color_parse_error(color: impl Into<String>) -> OakError
Creates a color parsing error.
Sourcepub fn format_error(message: impl Into<String>) -> OakError
pub fn format_error(message: impl Into<String>) -> OakError
Creates a formatting error.
Sourcepub fn semantic_error(message: impl Into<String>) -> OakError
pub fn semantic_error(message: impl Into<String>) -> OakError
Creates a semantic error.
Sourcepub fn protocol_error(message: impl Into<String>) -> OakError
pub fn protocol_error(message: impl Into<String>) -> OakError
Creates a protocol error.
Sourcepub fn serde_error(message: impl Into<String>) -> OakError
pub fn serde_error(message: impl Into<String>) -> OakError
Creates a serde serialization error.
Sourcepub fn deserialize_error(message: impl Into<String>) -> OakError
pub fn deserialize_error(message: impl Into<String>) -> OakError
Creates a serde deserialization error.
Sourcepub fn parse_error(message: impl Into<String>) -> OakError
pub fn parse_error(message: impl Into<String>) -> OakError
Creates a parse error.
Sourcepub fn internal_error(message: impl Into<String>) -> OakError
pub fn internal_error(message: impl Into<String>) -> OakError
Creates an internal error.
Sourcepub fn with_source_id(self, source_id: u32) -> OakError
pub fn with_source_id(self, source_id: u32) -> OakError
Attach a source ID to the error context.
Trait Implementations§
Source§impl Error for OakError
impl Error for OakError
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
Source§impl Error for OakError
Available on crate feature serde only.
impl Error for OakError
serde only.Source§fn custom<T>(msg: T) -> OakErrorwhere
T: Display,
fn custom<T>(msg: T) -> OakErrorwhere
T: Display,
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.