From c3ba30d55db81d65333c3df4702583b19f50f7d7 Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 9 Nov 2022 14:25:26 +0800 Subject: [PATCH] expand on errors reported --- services/pddb/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/pddb/src/lib.rs b/services/pddb/src/lib.rs index 97f43dd1e..2b195530c 100644 --- a/services/pddb/src/lib.rs +++ b/services/pddb/src/lib.rs @@ -603,7 +603,9 @@ impl Pddb { match response.code { PddbRequestCode::NoErr => (), PddbRequestCode::NotFound => return Err(Error::new(ErrorKind::NotFound, "dictionary not found")), - _ => return Err(Error::new(ErrorKind::Other, "Internal error")), + PddbRequestCode::AccessDenied => return Err(Error::new(ErrorKind::PermissionDenied, "concurrent operation in progress")), + PddbRequestCode::Uninit => return Err(Error::new(ErrorKind::ConnectionAborted, "Return code not set getting key count, server aborted?")), + _ => return Err(Error::new(ErrorKind::Other, "Internal error generating key count")), }; // v2 key listing packs the key list into a larger [u8] field that should cut down on the number of messages // required to list a large dictionary by about a factor of 50. @@ -625,7 +627,8 @@ impl Pddb { match response.retcode { ArchivedPddbRetcode::Ok => (), ArchivedPddbRetcode::AccessDenied => return Err(Error::new(ErrorKind::PermissionDenied, "KeyList facility locked by another process, try again later")), - _ => return Err(Error::new(ErrorKind::Other, "Internal Error")), + ArchivedPddbRetcode::Uninit => return Err(Error::new(ErrorKind::ConnectionAborted, "Return code not set fetching list, server aborted?")), + _ => return Err(Error::new(ErrorKind::Other, "Internal Error fetching list")), } // the [u8] data is structured as a packed list of u8-len + u8 data slice. The max length of // a PDDB key name is guaranteed to be shorter than a u8. If the length field is 0, then this