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) -> Self
pub fn test_failure(path: PathBuf, expected: String, actual: String) -> Self
Creates a test failure error.
Sourcepub fn test_regenerated(path: PathBuf) -> Self
pub fn test_regenerated(path: PathBuf) -> Self
Creates a test regenerated error.
Sourcepub fn syntax_error(
message: impl Into<String>,
offset: usize,
source_id: Option<SourceId>,
) -> Self
pub fn syntax_error( message: impl Into<String>, offset: usize, source_id: Option<SourceId>, ) -> Self
Sourcepub fn unexpected_character(
character: char,
offset: usize,
source_id: Option<SourceId>,
) -> Self
pub fn unexpected_character( character: char, offset: usize, source_id: Option<SourceId>, ) -> Self
Sourcepub fn unexpected_token(
token: impl Into<String>,
offset: usize,
source_id: Option<SourceId>,
) -> Self
pub fn unexpected_token( token: impl Into<String>, offset: usize, source_id: Option<SourceId>, ) -> Self
Creates an unexpected token error.
Sourcepub fn unexpected_eof(offset: usize, source_id: Option<SourceId>) -> Self
pub fn unexpected_eof(offset: usize, source_id: Option<SourceId>) -> Self
Creates an unexpected end of file error.
Sourcepub fn expected_token(
expected: impl Into<String>,
offset: usize,
source_id: Option<SourceId>,
) -> Self
pub fn expected_token( expected: impl Into<String>, offset: usize, source_id: Option<SourceId>, ) -> Self
Creates an expected token error.
Sourcepub fn expected_name(
name_kind: impl Into<String>,
offset: usize,
source_id: Option<SourceId>,
) -> Self
pub fn expected_name( name_kind: impl Into<String>, offset: usize, source_id: Option<SourceId>, ) -> Self
Creates an expected name error.
Sourcepub fn trailing_comma_not_allowed(
offset: usize,
source_id: Option<SourceId>,
) -> Self
pub fn trailing_comma_not_allowed( offset: usize, source_id: Option<SourceId>, ) -> Self
Creates a trailing comma not allowed error.
Sourcepub fn custom_error(message: impl Into<String>) -> Self
pub fn custom_error(message: impl Into<String>) -> Self
Sourcepub fn invalid_theme(message: impl Into<String>) -> Self
pub fn invalid_theme(message: impl Into<String>) -> Self
Creates an invalid theme error.
Sourcepub fn unsupported_format(format: impl Into<String>) -> Self
pub fn unsupported_format(format: impl Into<String>) -> Self
Creates an unsupported format error.
Sourcepub fn color_parse_error(color: impl Into<String>) -> Self
pub fn color_parse_error(color: impl Into<String>) -> Self
Creates a color parsing error.
Sourcepub fn format_error(message: impl Into<String>) -> Self
pub fn format_error(message: impl Into<String>) -> Self
Creates a formatting error.
Sourcepub fn semantic_error(message: impl Into<String>) -> Self
pub fn semantic_error(message: impl Into<String>) -> Self
Creates a semantic error.
Sourcepub fn protocol_error(message: impl Into<String>) -> Self
pub fn protocol_error(message: impl Into<String>) -> Self
Creates a protocol error.
Sourcepub fn serde_error(message: impl Into<String>) -> Self
pub fn serde_error(message: impl Into<String>) -> Self
Creates a serde serialization error.
Sourcepub fn deserialize_error(message: impl Into<String>) -> Self
pub fn deserialize_error(message: impl Into<String>) -> Self
Creates a serde deserialization error.
Sourcepub fn parse_error(message: impl Into<String>) -> Self
pub fn parse_error(message: impl Into<String>) -> Self
Creates a parse error.
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Creates an internal error.
Sourcepub fn with_source_id(self, source_id: SourceId) -> Self
pub fn with_source_id(self, source_id: SourceId) -> Self
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: 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.