aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/error.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util/error.rs b/src/util/error.rs
index ef5a76f2..bdb3a69b 100644
--- a/src/util/error.rs
+++ b/src/util/error.rs
@@ -59,8 +59,8 @@ pub enum Error {
)]
Quorum(usize, usize, usize, Vec<String>),
- #[error(display = "Bad RPC: {}", _0)]
- BadRpc(String),
+ #[error(display = "Unexpected RPC message: {}", _0)]
+ UnexpectedRpcMessage(String),
#[error(display = "Corrupt data: does not match hash {:?}", _0)]
CorruptData(Hash),
@@ -69,6 +69,12 @@ pub enum Error {
Message(String),
}
+impl Error {
+ pub fn unexpected_rpc_message<T: Serialize>(v: T) -> Self {
+ Self::UnexpectedRpcMessage(debug_serialize(&v))
+ }
+}
+
impl From<sled::transaction::TransactionError<Error>> for Error {
fn from(e: sled::transaction::TransactionError<Error>) -> Error {
match e {