pg_query/
error.rs

1use thiserror::Error;
2
3/// Error structure representing the basic error scenarios for `pg_query`.
4#[derive(Debug, Error, Eq, PartialEq)]
5pub enum Error {
6    #[error("Invalid statement format: {0}")]
7    Conversion(#[from] std::ffi::NulError),
8    #[error("Error decoding result: {0}")]
9    Decode(#[from] prost::DecodeError),
10    #[error("Invalid statement: {0}")]
11    Parse(String),
12    #[error("Error parsing JSON: {0}")]
13    InvalidJson(String),
14    #[error("Invalid pointer")]
15    InvalidPointer,
16    #[error("Error scanning: {0}")]
17    Scan(String),
18    #[error("Error splitting: {0}")]
19    Split(String),
20}
21
22/// Convenient Result alias for returning `pg_query::Error`.
23pub type Result<T> = core::result::Result<T, Error>;