p2panda_rs/entry/
error.rs1use thiserror::Error;
6
7#[derive(Error, Debug)]
9pub enum EntryBuilderError {
10 #[error(transparent)]
12 EncodeEntryError(#[from] EncodeEntryError),
13}
14
15#[derive(Error, Debug)]
17pub enum EncodeEntryError {
18 #[error(transparent)]
20 ValidateEntryError(#[from] ValidateEntryError),
21
22 #[error(transparent)]
24 BambooEncodeError(#[from] bamboo_rs_core_ed25519_yasmf::entry::encode::Error),
25}
26
27#[derive(Error, Debug)]
29pub enum DecodeEntryError {
30 #[error(transparent)]
32 ValidateEntryError(#[from] ValidateEntryError),
33
34 #[error(transparent)]
36 BambooDecodeError(#[from] bamboo_rs_core_ed25519_yasmf::entry::decode::Error),
37}
38
39#[derive(Error, Debug)]
41#[allow(missing_copy_implementations)]
42pub enum ValidateEntryError {
43 #[error("backlink and skiplink not valid for this sequence number")]
45 InvalidLinks,
46
47 #[error("operation needs to match payload hash of encoded entry")]
49 PayloadHashMismatch,
50
51 #[error("operation needs to match payload size of encoded entry")]
53 PayloadSizeMismatch,
54
55 #[error("backlink and skiplink are identical")]
57 BacklinkAndSkiplinkIdentical,
58
59 #[error("entry is in log id {0} but backlink entry in log id {1}")]
61 WrongBacklinkLogId(u64, u64),
62
63 #[error("entry is in log id {0} but skiplink entry in log id {1}")]
65 WrongSkiplinkLogId(u64, u64),
66
67 #[error("claimed author does not match backlink entry")]
69 WrongBacklinkAuthor,
70
71 #[error("claimed hash does not match backlink entry")]
73 WrongBacklinkHash,
74
75 #[error("claimed author does not match skiplink entry")]
77 WrongSkiplinkAuthor,
78
79 #[error("claimed hash does not match skiplink entry")]
81 WrongSkiplinkHash,
82
83 #[error("signature invalid")]
85 KeyPairError(#[from] crate::identity::error::KeyPairError),
86}
87
88#[derive(Error, Debug)]
90#[allow(missing_copy_implementations)]
91pub enum SeqNumError {
92 #[error("sequence number can not be zero or negative")]
94 NotZeroOrNegative,
95
96 #[error("string contains invalid u64 value")]
98 InvalidU64String,
99}
100
101#[derive(Error, Debug)]
103#[allow(missing_copy_implementations)]
104pub enum LogIdError {
105 #[error("string contains invalid u64 value")]
107 InvalidU64String,
108}