From 57a95ec6868a5d2ea9341a4273a4be3dd2af77e3 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 28 Apr 2023 18:32:14 +0200 Subject: [PATCH] Display errors since everything now is `Debug` --- src/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ebfe90f..eb5bd9e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,14 +58,14 @@ pub fn required(name: &str) -> Type match get(name, "_FILE") { Source::Var(Ok(v)) => v, - Source::Var(Err(var::Error::CannotConvertValue(_))) => - panic!("The contents of the {} environment variable could not be converted to a {}.", &name, &std::any::type_name::()), + Source::Var(Err(var::Error::CannotConvertValue(err))) => + panic!("The contents of the {} environment variable could not be converted to a {}: {:?}", &name, &std::any::type_name::(), &err), Source::Var(Err(var::Error::CannotReadEnvVar(_))) => panic!("Something unexpected happened in micronfig. Please report this as a bug!"), Source::File(Ok(v)) => v, - Source::File(Err(file::Error::CannotConvertValue(_))) => - panic!("The contents of the file at {} could not be converted to a {}.", &name, &std::any::type_name::()), + Source::File(Err(file::Error::CannotConvertValue(err))) => + panic!("The contents of the file at {} could not be converted to a {}: {:?}", &name, &std::any::type_name::(), &err), Source::File(Err(file::Error::CannotOpenFile(err))) => panic!("The file at {} could not be opened: {}", &name, &err), Source::File(Err(file::Error::CannotReadFile(err))) => @@ -117,14 +117,14 @@ pub fn optional(name: &str) -> Option match get(name, "_FILE") { Source::Var(Ok(v)) => Some(v), - Source::Var(Err(var::Error::CannotConvertValue(_))) => - panic!("The contents of the {} environment variable could not be converted to a {}.", &name, &std::any::type_name::()), + Source::Var(Err(var::Error::CannotConvertValue(err))) => + panic!("The contents of the {} environment variable could not be converted to a {}: {:?}", &name, &std::any::type_name::(), &err), Source::Var(Err(var::Error::CannotReadEnvVar(_))) => panic!("Something unexpected happened in micronfig. Please report this as a bug!"), Source::File(Ok(v)) => Some(v), - Source::File(Err(file::Error::CannotConvertValue(_))) => - panic!("The contents of the file at {} could not be converted to a {}.", &name, &std::any::type_name::()), + Source::File(Err(file::Error::CannotConvertValue(err))) => + panic!("The contents of the file at {} could not be converted to a {}: {:?}", &name, &std::any::type_name::(), &err), Source::File(Err(file::Error::CannotOpenFile(err))) => panic!("The file at {} could not be opened: {}", &name, &err), Source::File(Err(file::Error::CannotReadFile(err))) =>