pub struct ParseError {
pub message: String,
pub line: usize,
pub col: usize,
pub source_line: Option<String>,
pub detail: Option<&'static str>,
}Expand description
A parser error with source position information.
Fields§
§message: String§line: usize§col: usize§source_line: Option<String>Optional source line text for caret display.
detail: Option<&'static str>Optional symbolic openCypher-TCK error-detail name for this parse
failure (e.g. "IntegerOverflow", "FloatingPointOverflow").
A parse failure always renders as a SyntaxError class, but the TCK
error grammar also carries a finer detail (a SyntaxError should be raised at compile time: IntegerOverflow). This tag lets
EngineError::kind() surface that detail for the TCK harness
matcher without depending on relate-error (the dependency runs the
other way): the consumer maps the string through ErrorKind::from_name.
It is never rendered by Display, so tagging a ParseError
preserves the byte-for-byte error string (the prime invariant).
Implementations§
Source§impl ParseError
impl ParseError
pub fn new(message: impl Into<String>, line: usize, col: usize) -> Self
pub fn with_source(self, source: &str) -> Self
Sourcepub fn with_detail(self, detail: &'static str) -> Self
pub fn with_detail(self, detail: &'static str) -> Self
Tags this error with a symbolic TCK error-detail name (see
ParseError::detail). Does not affect Display.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()