1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! Engine error type.
use thiserror::Error;
/// Errors raised while lexing, parsing, or executing a query.
#[derive(Debug, Error)]
pub enum QuarbError {
/// A character or token could not be lexed.
#[error("lex error: {0}")]
Lex(String),
/// The token stream is not a valid query.
#[error("parse error: {0}")]
Parse(String),
/// A construct that is valid Quarb but not yet implemented.
#[error("not yet supported: {0}")]
Unsupported(String),
/// A failure in the macro-expansion phase — the body ran or
/// its output re-parsed and something went wrong there, as
/// distinct from reading the query text itself. The inner
/// error of a re-parse keeps its own banner; this variant
/// names the phase.
#[error("expansion error: {0}")]
Expansion(String),
/// A query the engine refuses to answer because the result
/// would be silently wrong or incomplete — the honest
/// alternative to returning a truncated answer (the same
/// doctrine as pushdown's refuse-or-fall-back, but with
/// nothing to fall back to).
#[error("refused: {0}")]
Refused(String),
}
/// Convenience alias for engine results.
pub type Result<T> = std::result::Result<T, QuarbError>;