Improve error output in cases when db_root / logfile is inaccesible (#2424)

This commit is contained in:
Can Selcik 2019-01-18 17:53:15 -08:00 committed by Ignotus Peverell
parent 8c4d14f654
commit f66bf3cb05
2 changed files with 4 additions and 3 deletions

View file

@ -66,7 +66,8 @@ pub fn new_env(path: String) -> lmdb::Environment {
/// Create a new LMDB env under the provided directory with the provided name.
pub fn new_named_env(path: String, name: String) -> lmdb::Environment {
let full_path = [path, name].join("/");
fs::create_dir_all(&full_path).unwrap();
fs::create_dir_all(&full_path)
.expect("Unable to create directory 'db_root' to store chain_data");
let mut env_builder = lmdb::EnvBuilder::new().unwrap();
env_builder.set_maxdbs(8).unwrap();

View file

@ -136,7 +136,7 @@ pub fn init_logger(config: Option<LoggingConfig>) {
.append(c.log_file_append)
.encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN)))
.build(c.log_file_path, Box::new(policy))
.unwrap(),
.expect("Failed to create logfile"),
)
} else {
Box::new(
@ -144,7 +144,7 @@ pub fn init_logger(config: Option<LoggingConfig>) {
.append(c.log_file_append)
.encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN)))
.build(c.log_file_path)
.unwrap(),
.expect("Failed to create logfile"),
)
}
};