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
15pub mod cache;
17pub mod contract;
19pub mod document;
21pub mod drive;
23pub mod fee;
25pub mod identity;
27pub mod proof;
29pub mod query;
31
32#[derive(Debug, thiserror::Error)]
34pub enum Error {
35 #[error("query: {0}")]
37 Query(#[from] QuerySyntaxError),
38 #[error("storage flags: {0}")]
40 StorageFlags(#[from] StorageFlagsError),
41 #[error("drive: {0}")]
43 Drive(#[from] DriveError),
44 #[error("proof: {0}")]
46 Proof(#[from] ProofError),
47 #[error("grovedb: {0}")]
49 GroveDB(Box<grovedb::Error>),
50 #[error("protocol: {0}")]
52 Protocol(Box<ProtocolError>),
53 #[error("identity: {0}")]
55 Identity(#[from] IdentityError),
56 #[error("fee: {0}")]
58 Fee(#[from] FeeError),
59 #[error("document: {0}")]
61 Document(#[from] DocumentError),
62 #[error("value: {0}")]
64 Value(#[from] ValueError),
65 #[error("contract: {0}")]
67 DataContract(#[from] DataContractError),
68 #[error("contract: {0}")]
70 Cache(#[from] CacheError),
71 #[error("protocol: {0} ({1})")]
73 ProtocolWithInfoString(Box<ProtocolError>, String),
74 #[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}