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:
parent
6c955c508f
commit
57a95ec686
1 changed files with 8 additions and 8 deletions
16
src/lib.rs
16
src/lib.rs
|
@ -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))) =>
|
||||
|
|
Loading…
Reference in a new issue