drive_abci/error/
query.rs

1use dpp::platform_value::Error as ValueError;
2use dpp::util::deserializer::ProtocolVersion;
3use dpp::version::FeatureVersion;
4use dpp::ProtocolError;
5use drive::error::proof::ProofError;
6use drive::error::query::QuerySyntaxError as SyntaxError;
7use drive::error::Error as DriveError;
8use prost::DecodeError;
9use tenderdash_abci::proto::abci::ResponseException;
10
11// @append_only
12/// Errors
13#[derive(Debug, thiserror::Error)]
14pub enum QueryError {
15    /// Proof Error
16    #[error("proof error: {0}")]
17    Proof(#[from] ProofError),
18
19    /// Syntax Error
20    #[error("query syntax error: {0}")]
21    Query(#[from] SyntaxError),
22
23    /// Protocol Error
24    #[error("protocol error: {0}")]
25    Protocol(#[from] ProtocolError),
26
27    /// Value Error
28    #[error("query value error: {0}")]
29    Value(#[from] ValueError),
30
31    /// Drive Error
32    #[error("drive error: {0}")]
33    Drive(#[from] DriveError),
34
35    /// Decoding error Error
36    #[error("protobuf decoding error: {0}")]
37    ProtobufDecode(#[from] DecodeError),
38
39    /// Invalid argument Error
40    #[error("invalid argument error: {0}")]
41    InvalidArgument(String),
42
43    /// Too many elements Error
44    #[error("too many elements error: {0}")]
45    TooManyElements(String),
46
47    /// Not found Error
48    #[error("not found error: {0}")]
49    NotFound(String),
50
51    /// Server issue
52    #[error("query not serviceable: {0}")]
53    NotServiceable(String),
54
55    /// Decoding Error
56    #[error("decoding error: {0}")]
57    DecodingError(String),
58
59    /// Not found Error
60    #[error("unsupported version for query: {0}, currently supporting versions {1} to {2} on platform protocol {3}, given {4}")]
61    UnsupportedQueryVersion(
62        String,
63        FeatureVersion,
64        FeatureVersion,
65        ProtocolVersion,
66        FeatureVersion,
67    ),
68}
69
70impl From<QueryError> for ResponseException {
71    fn from(value: QueryError) -> Self {
72        Self {
73            error: value.to_string(),
74        }
75    }
76}