1
Fork 0
mirror of https://github.com/Steffo99/micronfig.git synced 2024-11-21 15:44:20 +00:00

Display errors since everything now is Debug

This commit is contained in:
Steffo 2023-04-28 18:32:14 +02:00
parent 6c955c508f
commit 57a95ec686
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -58,14 +58,14 @@ pub fn required<Type>(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::<Type>()),
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::<Type>(), &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::<Type>()),
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::<Type>(), &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<Type>(name: &str) -> Option<Type>
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::<Type>()),
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::<Type>(), &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::<Type>()),
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::<Type>(), &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))) =>