Mercurial > lbo > hg > leveldb-rs
changeset 475:7b90bc62f284
Return better error on fcntl failure
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Wed, 10 Jul 2019 22:03:00 +0200 |
parents | e9eb1e007101 |
children | 7131b39ef70e |
files | Cargo.toml src/disk_env.rs src/error.rs src/lib.rs |
diffstat | 4 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Cargo.toml Wed Jun 19 19:32:57 2019 +0200 +++ b/Cargo.toml Wed Jul 10 22:03:00 2019 +0200 @@ -15,6 +15,7 @@ libc = "0.2" rand = "0.4" snap = "0.2" +errno = "0.2" [dev-dependencies] time-test = "0.2"
--- a/src/disk_env.rs Wed Jun 19 19:32:57 2019 +0200 +++ b/src/disk_env.rs Wed Jul 10 22:03:00 2019 +0200 @@ -146,7 +146,7 @@ if result < 0 { return Err(Status::new( - StatusCode::AlreadyExists, + StatusCode::Errno(errno::errno()), "Lock is held (fcntl)", )); }
--- a/src/error.rs Wed Jun 19 19:32:57 2019 +0200 +++ b/src/error.rs Wed Jul 10 22:03:00 2019 +0200 @@ -5,6 +5,7 @@ use std::result; use std::sync; +use errno; use snap; /// StatusCode describes various failure modes of database operations. @@ -24,6 +25,7 @@ NotSupported, PermissionDenied, Unknown, + Errno(errno::Errno), } /// Status encapsulates a `StatusCode` and an error message. It can be displayed, and also