1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use holochain_types::dht_op::DhtOpType;
use holochain_zome_types::HeaderType;
use thiserror::Error;

use crate::scratch::SyncScratchError;
#[derive(Error, Debug)]
pub enum StateQueryError {
    #[error(transparent)]
    Sql(#[from] holochain_sqlite::rusqlite::Error),
    #[error(transparent)]
    Infallible(#[from] std::convert::Infallible),
    #[error(transparent)]
    DatabaseError(#[from] holochain_sqlite::error::DatabaseError),
    #[error(transparent)]
    SerializedBytesError(#[from] holochain_serialized_bytes::SerializedBytesError),
    #[error(transparent)]
    DhtOpError(#[from] holochain_types::dht_op::error::DhtOpError),
    #[error("Unexpected op {0:?} for query")]
    UnexpectedOp(DhtOpType),
    #[error("Unexpected header {0:?} for query")]
    UnexpectedHeader(HeaderType),
    #[error(transparent)]
    WrongHeaderError(#[from] holochain_zome_types::WrongHeaderError),
    #[error(transparent)]
    HeaderError(#[from] holochain_zome_types::header::HeaderError),
    #[error(transparent)]
    SyncScratchError(#[from] SyncScratchError),
}

pub type StateQueryResult<T> = Result<T, StateQueryError>;