mirror of
https://github.com/NLnetLabs/routinator.git
synced 2024-05-19 06:50:04 +00:00
Improve missing directory errors.
This commit is contained in:
@ -26,7 +26,7 @@ lazy_static! {
|
||||
static ref CONFIG: Config = Config::create();
|
||||
}
|
||||
|
||||
fn main() -> Result<(), ProcessingError> {
|
||||
fn main() {
|
||||
let config = &CONFIG;
|
||||
|
||||
env_logger::Builder::new()
|
||||
@ -34,11 +34,15 @@ fn main() -> Result<(), ProcessingError> {
|
||||
.format(|buf, record| write!(buf, "{}\n", record.args()))
|
||||
.init();
|
||||
|
||||
if config.mode.is_once() {
|
||||
let res = if config.mode.is_once() {
|
||||
run_once(config)
|
||||
}
|
||||
else {
|
||||
run_forever(config)
|
||||
};
|
||||
|
||||
if let Err(err) = res {
|
||||
println!("{}\nAborted.", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,10 +69,16 @@ impl Repository {
|
||||
rsync: bool
|
||||
) -> Result<Self, ProcessingError> {
|
||||
if let Err(err) = fs::read_dir(&cache_dir) {
|
||||
return Err(ProcessingError::BadCacheDirectory(err))
|
||||
return Err(ProcessingError::BadCacheDirectory(
|
||||
format!("{}", cache_dir.display()),
|
||||
err
|
||||
))
|
||||
}
|
||||
if let Err(err) = fs::read_dir(&tal_dir) {
|
||||
return Err(ProcessingError::BadTalDirectory(err))
|
||||
return Err(ProcessingError::BadTalDirectory(
|
||||
format!("{}", tal_dir.display()),
|
||||
err
|
||||
))
|
||||
}
|
||||
Ok(Repository(Arc::new(RepoInner {
|
||||
cache_dir,
|
||||
@ -718,11 +724,11 @@ fn entry_to_uri_component(entry: &DirEntry) -> Option<Bytes> {
|
||||
|
||||
#[derive(Debug, Fail)]
|
||||
pub enum ProcessingError {
|
||||
#[fail(display="failed to open repository cache directory: {}", _0)]
|
||||
BadCacheDirectory(io::Error),
|
||||
#[fail(display="failed to open cache directory {}: {}", _0, _1)]
|
||||
BadCacheDirectory(String, io::Error),
|
||||
|
||||
#[fail(display="failed to open trust anchor directory: {}", _0)]
|
||||
BadTalDirectory(io::Error),
|
||||
#[fail(display="failed to open trust anchor directory {}: {}", _0, _1)]
|
||||
BadTalDirectory(String, io::Error),
|
||||
|
||||
#[fail(display="{}", _0)]
|
||||
Rsync(RsyncError),
|
||||
|
Reference in New Issue
Block a user