diff --git a/micronfig/src/envdot.rs b/micronfig/src/envdot.rs
index 500a0a8..c7514ec 100644
--- a/micronfig/src/envdot.rs
+++ b/micronfig/src/envdot.rs
@@ -21,7 +21,7 @@ pub fn parse_dotenv
(value: P) -> Option
let mut contents: String = String::new();
file.read_to_string(&mut contents)
- .expect(&format!("to be able to read {value:?}"));
+ .unwrap_or_else(|_| panic!("to be able to read {value:?}"));
let mut keys: HashMap = HashMap::new();
diff --git a/micronfig/src/envfiles.rs b/micronfig/src/envfiles.rs
index aa11561..4c50e50 100644
--- a/micronfig/src/envfiles.rs
+++ b/micronfig/src/envfiles.rs
@@ -13,11 +13,11 @@ pub fn get(key: &OsStr) -> Option {
let path = std::path::PathBuf::from(path);
let mut file = std::fs::File::open(&path)
- .expect(&format!("to be able to open file at {path:?}"));
+ .unwrap_or_else(|_| panic!("to be able to open file at {path:?}"));
let mut data = String::new();
file.read_to_string(&mut data)
- .expect(&format!("to be able to read from file at {path:?}"));
+ .unwrap_or_else(|_| panic!("to be able to read from file at {path:?}"));
Some(data)
}