mirror of
https://github.com/Steffo99/micronfig.git
synced 2024-11-24 09:04:18 +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") {
|
match get(name, "_FILE") {
|
||||||
Source::Var(Ok(v)) => v,
|
Source::Var(Ok(v)) => v,
|
||||||
Source::Var(Err(var::Error::CannotConvertValue(_))) =>
|
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>()),
|
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(_))) =>
|
Source::Var(Err(var::Error::CannotReadEnvVar(_))) =>
|
||||||
panic!("Something unexpected happened in micronfig. Please report this as a bug!"),
|
panic!("Something unexpected happened in micronfig. Please report this as a bug!"),
|
||||||
|
|
||||||
Source::File(Ok(v)) => v,
|
Source::File(Ok(v)) => v,
|
||||||
Source::File(Err(file::Error::CannotConvertValue(_))) =>
|
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>()),
|
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))) =>
|
Source::File(Err(file::Error::CannotOpenFile(err))) =>
|
||||||
panic!("The file at {} could not be opened: {}", &name, &err),
|
panic!("The file at {} could not be opened: {}", &name, &err),
|
||||||
Source::File(Err(file::Error::CannotReadFile(err))) =>
|
Source::File(Err(file::Error::CannotReadFile(err))) =>
|
||||||
|
@ -117,14 +117,14 @@ pub fn optional<Type>(name: &str) -> Option<Type>
|
||||||
|
|
||||||
match get(name, "_FILE") {
|
match get(name, "_FILE") {
|
||||||
Source::Var(Ok(v)) => Some(v),
|
Source::Var(Ok(v)) => Some(v),
|
||||||
Source::Var(Err(var::Error::CannotConvertValue(_))) =>
|
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>()),
|
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(_))) =>
|
Source::Var(Err(var::Error::CannotReadEnvVar(_))) =>
|
||||||
panic!("Something unexpected happened in micronfig. Please report this as a bug!"),
|
panic!("Something unexpected happened in micronfig. Please report this as a bug!"),
|
||||||
|
|
||||||
Source::File(Ok(v)) => Some(v),
|
Source::File(Ok(v)) => Some(v),
|
||||||
Source::File(Err(file::Error::CannotConvertValue(_))) =>
|
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>()),
|
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))) =>
|
Source::File(Err(file::Error::CannotOpenFile(err))) =>
|
||||||
panic!("The file at {} could not be opened: {}", &name, &err),
|
panic!("The file at {} could not be opened: {}", &name, &err),
|
||||||
Source::File(Err(file::Error::CannotReadFile(err))) =>
|
Source::File(Err(file::Error::CannotReadFile(err))) =>
|
||||||
|
|
Loading…
Reference in a new issue