Skip to main content

nodedb_physical/
error.rs

1// SPDX-License-Identifier: Apache-2.0
2
3//! Error type for the shared SqlPlan → PhysicalPlan converter helpers.
4//!
5//! The variant set matches what the converter actually produces; deeper
6//! engine-specific failures are re-wrapped at the deployment boundary.
7//! Origin maps `ConvertError → nodedb::Error`; Lite will map it to its
8//! own error type.
9
10#[derive(Debug, thiserror::Error)]
11pub enum ConvertError {
12    /// The plan shape is invalid (unsupported combination, missing field, etc.).
13    #[error("plan error: {0}")]
14    PlanError(String),
15
16    /// A client-facing request is malformed (bad cast, wrong literal type, etc.).
17    #[error("bad request: {0}")]
18    BadRequest(String),
19
20    /// A defensive cap was exceeded (max fan-out, depth, columns, etc.).
21    #[error("{limit_name} exceeded: {value} > {max}")]
22    LimitExceeded {
23        limit_name: &'static str,
24        value: u64,
25        max: u64,
26    },
27
28    /// Serialization failure (msgpack encoding of filters, projections, etc.).
29    #[error("serialization: {0}")]
30    Serialization(String),
31
32    /// Catch-all for converter-internal failures that don't fit the above
33    /// and that we don't want to leak from the shared crate as untyped strings.
34    /// Carries a `'static` short reason; full detail propagates via `cause`.
35    #[error("converter internal: {0}")]
36    Other(String),
37}