Better error message if database is locked.
@@ -151,7 +151,7 @@ impl Engine {
if let Err(err) = fs::remove_dir_all(&db_path) {
if err.kind() != io::ErrorKind::NotFound {
error!(
- "Failed to delete store database at {}: {}",
+ "Failed to delete database at {}: {}",
db_path.display(), err
);
return Err(Failed)
@@ -160,11 +160,25 @@ impl Engine {
}
sled::open(&db_path).map_err(|err| {
+ match err {
+ sled::Error::Io(ref err)
+ if err.kind() == io::ErrorKind::WouldBlock
+ => {
error!(
- "Failed to open store database at {}: {}",
+ "Failed to open database at {}.\n\
+ The database is in use. Is there another \
+ Routinator running?",
+ db_path.display()
+ );
+ }
+ err => {
+ error!(
+ "Failed to open database at {}: {}",
db_path.display(),
err
);
+ }
+ }
Failed
})
}
