Skip to main content

ParseError

Struct ParseError 

Source
pub struct ParseError<'a>(/* private fields */);
Expand description

Parse error for one SQLite statement.

Includes diagnostics you can show directly to users:

  • Error class (kind(): recovered vs fatal).
  • Error message (message()).
  • Optional location (offset() / length()).
  • Optional partial recovery tree (recovery_root()).

Implementations§

Source§

impl<'a> ParseError<'a>

Source

pub fn kind(&self) -> ParseErrorKind

Whether parsing recovered (Recovered) or fully failed (Fatal).

Source

pub fn is_recovered(&self) -> bool

True if this error was recovered and yielded a partial tree.

Source

pub fn is_fatal(&self) -> bool

True if this error is fatal (unrecoverable).

Source

pub fn message(&self) -> &str

Human-readable diagnostic text.

Source

pub fn offset(&self) -> Option<usize>

Byte offset in the original source, if known.

Source

pub fn length(&self) -> Option<usize>

Byte length of the offending range, if known.

Source

pub fn recovery_root(&'a self) -> Option<Stmt<'a>>

Partial AST recovered from invalid input, if available.

Mirrors C syntaqlite_result_recovery_root for PARSE_ERROR.

Source

pub fn parse_source(&self) -> &'a str

The source text bound to this result.

Source

pub fn tokens(&self) -> impl Iterator<Item = ParserToken<'a>>

Tokens collected during the (partial) parse, if collect_tokens was enabled.

Source

pub fn comments(&self) -> impl Iterator<Item = Comment<'a>>

Comments collected during the (partial) parse, if collect_tokens was enabled.