-
Notifications
You must be signed in to change notification settings - Fork 136
/
error.rs
executable file
·84 lines (67 loc) · 2.71 KB
/
error.rs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#![deny(missing_docs)]
//! Errors occurring during a [Ribosome] call
use crate::core::state::{cascade::error::CascadeError, source_chain::SourceChainError};
use crate::core::workflow::call_zome_workflow::unsafe_call_zome_workspace::error::UnsafeCallZomeWorkspaceError;
use holo_hash::AnyDhtHash;
use holochain_crypto::CryptoError;
use holochain_serialized_bytes::prelude::SerializedBytesError;
use holochain_types::dna::error::DnaError;
use holochain_wasmer_host::prelude::WasmError;
use holochain_zome_types::zome::ZomeName;
use thiserror::Error;
use tokio::task::JoinError;
use tokio_safe_block_on::BlockOnError;
/// Errors occurring during a [Ribosome] call
#[derive(Error, Debug)]
pub enum RibosomeError {
/// Dna error while working with Ribosome.
#[error("Dna error while working with Ribosome: {0}")]
DnaError(#[from] DnaError),
/// Wasm error while working with Ribosome.
#[error("Wasm error while working with Ribosome: {0}")]
WasmError(#[from] WasmError),
/// Serialization error while working with Ribosome.
#[error("Serialization error while working with Ribosome: {0}")]
SerializationError(#[from] SerializedBytesError),
/// A Zome was referenced by name that doesn't exist
#[error("Referenced a zome that doesn't exist: Zome: {0}")]
ZomeNotExists(ZomeName),
/// A ZomeFn was called by name that doesn't exist
#[error("Attempted to call a zome function that doesn't exist: Zome: {0} Fn {1}")]
ZomeFnNotExists(ZomeName, String),
/// a problem with entry defs
#[error("An error with entry defs: {0}")]
EntryDefs(ZomeName, String),
/// a mandatory dependency for an element doesn't exist
/// for example a remove link ribosome call needs to find the add link in order to infer the
/// correct base and this dependent relationship exists before even subconscious validation
/// kicks in
#[error("A mandatory element is missing, dht hash: {0}")]
ElementDeps(AnyDhtHash),
/// ident
#[error(transparent)]
CryptoError(#[from] CryptoError),
/// ident
#[error(transparent)]
DatabaseError(#[from] holochain_state::error::DatabaseError),
/// ident
#[error(transparent)]
CascadeError(#[from] CascadeError),
/// ident
#[error(transparent)]
UnsafeCallZomeWorkspaceError(#[from] UnsafeCallZomeWorkspaceError),
/// ident
#[error(transparent)]
SourceChainError(#[from] SourceChainError),
/// ident
#[error(transparent)]
BlockOnError(#[from] BlockOnError),
/// ident
#[error(transparent)]
JoinError(#[from] JoinError),
/// ident
#[error(transparent)]
P2pError(#[from] holochain_p2p::HolochainP2pError),
}
/// Type alias
pub type RibosomeResult<T> = Result<T, RibosomeError>;