python_ast/
result.rs

1
2use pyo3::PyErr;
3use thiserror::Error as E;
4
5use crate::{BinOp, BoolOp, Compare, Expr, ExprType, StatementType, UnaryOp};
6
7#[derive(E, Debug)]
8pub enum Error {
9    #[error("BinOp type not yet implemented: {:?}", .0)]
10    BinOpNotYetImplemented(BinOp),
11
12    #[error("BoolOp type not yet implemented: {:?}", .0)]
13    BoolOpNotYetImplemented(BoolOp),
14
15    #[error("Compare type not yet implemented: {:?}", .0)]
16    CompareNotYetImplemented(Compare),
17
18    #[error("Expr type not yet implemented: {:?}", .0)]
19    ExprNotYetImplemented(Expr),
20    #[error("ExprType type not yet implemented: {:?}", .0)]
21    ExprTypeNotYetImplemented(ExprType),
22
23    #[error("Unknown type {0}")]
24    UnknownType(String),
25
26    #[error("PyO3 Error: {0}")]
27    #[from(PyErr)]
28    Pyo3Error(PyErr),
29
30    #[error("Statement type not yet implemented: {:?}", .0)]
31    StatementNotYetImplemented(StatementType),
32    #[error("UnaryOp type not yet implemented: {:?}", .0)]
33    UnaryOpNotYetImplemented(UnaryOp),
34
35    #[error("Unknown Error: {0}")]
36    #[from(Box<dyn std::error::Error>)]
37    UnknownError(Box<dyn std::error::Error>),
38}
39
40pub type Result<T> = std::result::Result<T, Error>;