From f5f8dfa188f56d63ad635de17ac3ba2154806b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Mon, 29 Nov 2021 00:24:27 +0100 Subject: [PATCH] Better error message when config not found --- src/config.rs | 8 ++++++-- src/lib.rs | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 69d8442..7a0caec 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,8 +21,12 @@ pub fn read_config(path: &str) -> Result { Err(e) => { return Err(format!( "Error reading configuration file \"{}\": {}", - path, e - )) + path, + match e.kind() { + std::io::ErrorKind::NotFound => String::from("not found"), + _ => e.to_string(), + } + )); } }; diff --git a/src/lib.rs b/src/lib.rs index be54938..253776c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![feature(io_error_more)] + use std::fs; use std::path::{Path, PathBuf}; use std::process;