aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-02-21 13:45:41 +0100
committerAlex Auvolat <alex@adnab.me>2022-02-21 13:45:41 +0100
commit96a3cc1e1f5c0c4e73ad1036a7e0add19d9a197e (patch)
tree3903e11ac310ec441db2360b6951b35c63617974 /src/error.rs
parent5bf3886fa28812d7009fb3bb481f0d3ce3004e18 (diff)
downloadnetapp-96a3cc1e1f5c0c4e73ad1036a7e0add19d9a197e.tar.gz
netapp-96a3cc1e1f5c0c4e73ad1036a7e0add19d9a197e.zip
Implement version check & transmit more error info
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/error.rs b/src/error.rs
index 0ed30a5..99acdd1 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -34,8 +34,11 @@ pub enum Error {
#[error(display = "Connection closed")]
ConnectionClosed,
- #[error(display = "Remote error: {}", _0)]
- Remote(String),
+ #[error(display = "Version mismatch: {}", _0)]
+ VersionMismatch(String),
+
+ #[error(display = "Remote error {}: {}", _0, _1)]
+ Remote(u8, String),
}
impl Error {
@@ -50,7 +53,8 @@ impl Error {
Self::NoHandler => 20,
Self::ConnectionClosed => 21,
Self::Handshake(_) => 30,
- Self::Remote(_) => 40,
+ Self::VersionMismatch(_) => 31,
+ Self::Remote(c, _) => *c,
Self::Message(_) => 99,
}
}