drive/error/
mod.rs

1use self::drive::DriveError;
2use crate::error::cache::CacheError;
3use crate::error::contract::DataContractError;
4use crate::error::proof::ProofError;
5use document::DocumentError;
6use dpp::data_contract::errors::DataContractError as ProtocolDataContractError;
7use dpp::platform_value::Error as ValueError;
8use dpp::ProtocolError;
9use fee::FeeError;
10use grovedb_epoch_based_storage_flags::error::StorageFlagsError;
11use identity::IdentityError;
12use query::QuerySyntaxError;
13use std::io;
14
15/// Cache errors
16pub mod cache;
17///DataContract errors
18pub mod contract;
19/// Document module
20pub mod document;
21/// Drive module
22pub mod drive;
23/// Fee module
24pub mod fee;
25/// Identity module
26pub mod identity;
27/// Proof module
28pub mod proof;
29/// Query module
30pub mod query;
31
32/// Errors
33#[derive(Debug, thiserror::Error)]
34pub enum Error {
35    /// Query error
36    #[error("query: {0}")]
37    Query(#[from] QuerySyntaxError),
38    /// Storage Flags error
39    #[error("storage flags: {0}")]
40    StorageFlags(#[from] StorageFlagsError),
41    /// Drive error
42    #[error("drive: {0}")]
43    Drive(#[from] DriveError),
44    /// Drive error
45    #[error("proof: {0}")]
46    Proof(#[from] ProofError),
47    /// GroveDB error
48    #[error("grovedb: {0}")]
49    GroveDB(Box<grovedb::Error>),
50    /// Protocol error
51    #[error("protocol: {0}")]
52    Protocol(Box<ProtocolError>),
53    /// Identity error
54    #[error("identity: {0}")]
55    Identity(#[from] IdentityError),
56    /// Fee error
57    #[error("fee: {0}")]
58    Fee(#[from] FeeError),
59    /// Document error
60    #[error("document: {0}")]
61    Document(#[from] DocumentError),
62    /// Value error
63    #[error("value: {0}")]
64    Value(#[from] ValueError),
65    ///DataContract error
66    #[error("contract: {0}")]
67    DataContract(#[from] DataContractError),
68    ///Cache error
69    #[error("contract: {0}")]
70    Cache(#[from] CacheError),
71    /// Protocol error
72    #[error("protocol: {0} ({1})")]
73    ProtocolWithInfoString(Box<ProtocolError>, String),
74    /// IO error
75    #[error("io: {0} ({1})")]
76    IOErrorWithInfoString(Box<io::Error>, String),
77}
78
79impl From<ProtocolDataContractError> for Error {
80    fn from(value: ProtocolDataContractError) -> Self {
81        Self::Protocol(Box::new(ProtocolError::DataContractError(value)))
82    }
83}
84
85impl From<ProtocolError> for Error {
86    fn from(value: ProtocolError) -> Self {
87        Self::Protocol(Box::new(value))
88    }
89}
90
91impl From<grovedb::Error> for Error {
92    fn from(value: grovedb::Error) -> Self {
93        Self::GroveDB(Box::new(value))
94    }
95}
96
97impl From<grovedb::element::error::ElementError> for Error {
98    fn from(value: grovedb::element::error::ElementError) -> Self {
99        Self::GroveDB(Box::new(grovedb::Error::ElementError(value)))
100    }
101}