From beeef4758e5ec0d521179a799a3237c2c0368911 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 3 Jan 2022 13:58:05 +0100 Subject: Some movement of helper code and refactoring of error handling --- src/table/gc.rs | 2 +- src/table/sync.rs | 7 ++----- src/table/table.rs | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/table') diff --git a/src/table/gc.rs b/src/table/gc.rs index 5cb8cb9b..8d0a5bef 100644 --- a/src/table/gc.rs +++ b/src/table/gc.rs @@ -315,7 +315,7 @@ where } Ok(GcRpc::Ok) } - _ => Err(Error::Message("Unexpected GC RPC".to_string())), + m => Err(Error::unexpected_rpc_message(m)), } } } diff --git a/src/table/sync.rs b/src/table/sync.rs index df9fb4d0..1df2b01d 100644 --- a/src/table/sync.rs +++ b/src/table/sync.rs @@ -514,10 +514,7 @@ where if let SyncRpc::Ok = rpc_resp { Ok(()) } else { - Err(Error::Message(format!( - "Unexpected response to RPC Update: {}", - debug_serialize(&rpc_resp) - ))) + Err(Error::unexpected_rpc_message(rpc_resp)) } } } @@ -545,7 +542,7 @@ where self.data.update_many(items)?; Ok(SyncRpc::Ok) } - _ => Err(Error::Message("Unexpected sync RPC".to_string())), + m => Err(Error::unexpected_rpc_message(m)), } } } diff --git a/src/table/table.rs b/src/table/table.rs index 396888c1..01789c11 100644 --- a/src/table/table.rs +++ b/src/table/table.rs @@ -311,7 +311,7 @@ where self.data.update_many(pairs)?; Ok(TableRpc::Ok) } - _ => Err(Error::BadRpc("Unexpected table RPC".to_string())), + m => Err(Error::unexpected_rpc_message(m)), } } } -- cgit v1.2.3