Skip to content

Commit 63930f7

Browse files
authored
Merge pull request #9 from AIBlockOfficial/feature_api_error_msg
Added errors to APIErrorType
2 parents 4b1eeef + c2d9edf commit 63930f7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "valence_core"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
edition = "2021"
55
license = "MIT"
66
keywords = ["blockchain", "L2", "peer-to-peer", "P2P"]

src/api/errors.rs

+14
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ pub enum ApiErrorType {
5353
CuckooFilterInsertionFailed,
5454
CuckooFilterLookupFailed,
5555
DataSerializationFailed,
56+
DataDeserializationFailed,
57+
DBQueryFailed,
58+
CacheDeleteFailed,
59+
ValueDeleteFailed,
60+
CacheQueryFailed,
61+
ValueIdNotFound,
62+
DataNotFound,
5663
}
5764

5865
impl std::fmt::Display for ApiErrorType {
@@ -70,6 +77,13 @@ impl std::fmt::Display for ApiErrorType {
7077
"Cuckoo filter lookup failed, data for address not found on this Valence"
7178
),
7279
ApiErrorType::DataSerializationFailed => write!(f, "Data serialization failed"),
80+
ApiErrorType::DataDeserializationFailed => write!(f, "Data deserialization failed"),
81+
ApiErrorType::DBQueryFailed => write!(f, "Data fetch on db failed"),
82+
ApiErrorType::CacheQueryFailed => write!(f, "Data fetch on cache failed"),
83+
ApiErrorType::CacheDeleteFailed => write!(f, "Cache deletion failed"),
84+
ApiErrorType::ValueDeleteFailed => write!(f, "Value deletion failed"),
85+
ApiErrorType::DataNotFound => write!(f, "Data not found"),
86+
ApiErrorType::ValueIdNotFound => write!(f, "Value ID not found"),
7387
}
7488
}
7589
}

0 commit comments

Comments
 (0)