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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use crdts::Dot;
use sn_data_types::{Credit, Debit, Error as DtError, PublicKey, Token};
use thiserror::Error;
#[derive(Error, Debug, PartialEq)]
#[non_exhaustive]
pub enum Error {
#[error("Sender missing from actors")]
MissingSender,
#[error("Recipient missing from actors")]
MissingRecipient,
#[error("Sender and recipient are the same")]
SameSenderAndRecipient,
#[error("Current pending debit has not been completed")]
DebitPending,
#[error("PublicKey provided by the transfer was never a part of the section chain.")]
SectionKeyNeverExisted,
#[error("Debit already proposed or out of order")]
DebitProposed,
#[error("Credit and debit ids do not match")]
CreditDebitIdMismatch,
#[error("Credit and debit value do not match")]
CreditDebitValueMismatch,
#[error("Validation not intended for this actor")]
WrongValidationActor,
#[error("Could not find the expected transfer id among accumulating validations")]
PendingTransferNotFound,
#[error("Validation not expected at this actor {0:?}")]
NoSetForDebitId(Dot<PublicKey>),
#[error("Transfer not expected for this actor {0:?}")]
NoSetForTransferId(Dot<PublicKey>),
#[error("Operation out of order: debit's counter is '{0}', current actor counter is '{1}'")]
OperationOutOfOrder(u64, u64),
#[error("Operation out of order debit counter should be 0")]
ShouldBeInitialOperation,
#[error("No credits or debits found to sync to actor")]
NothingToSync,
#[error("Transfer amount must be greater than zero")]
ZeroValueTransfer,
#[error("Validation already received")]
ValidatedAlready,
#[error("Debit is not from wallet {0}. Debit: {1:?}")]
DebitDoesNotBelong(PublicKey, Debit),
#[error("Credit is not from wallet {0}. Credit: {1:?}")]
CreditDoesNotBelong(PublicKey, Credit),
#[error("Overflow when subtracting {0} from balance of: {1}")]
SubtractionOverflow(Token, Token),
#[error("Overflow when adding balance {0} and credit of: {1}")]
AdditionOverflow(Token, Token),
#[error("Unexpected outcome")]
UnexpectedOutcome,
#[error("Unknown error: {0}")]
Unknown(String),
#[error("Wallet not found locally. The following debit was the cause: {0:?}")]
WalletNotFound(Debit),
#[error("Could not aggregate with given signature shares")]
CannotAggregate,
#[error("Signature is not valid")]
InvalidSignature,
#[error("Operation is not valid")]
InvalidOperation,
#[error("Owner is not valid")]
InvalidOwner,
#[error("Insufficient balance to complete this operation")]
InsufficientBalance,
#[error("No such sender key balance")]
NoSuchSender,
#[error("No such recipient key balance")]
NoSuchRecipient,
#[error("Key already exists")]
KeyExists,
#[error(transparent)]
NetworkDataError(#[from] DtError),
#[error("Serialisation error. {0}")]
Serialisation(String),
}