Skip to content

Commit

Permalink
expand on errors reported
Browse files Browse the repository at this point in the history
  • Loading branch information
bunnie committed Nov 9, 2022
1 parent e7e110c commit c3ba30d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions services/pddb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit c3ba30d

Please sign in to comment.