From cd4296c9412c1579cbe4058c7bd409becab1b726 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 31 Jan 2024 12:18:30 -0500 Subject: [PATCH] Add error for float parse failures --- src/error.rs | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/error.rs b/src/error.rs index 46fba06..378d024 100644 --- a/src/error.rs +++ b/src/error.rs @@ -245,62 +245,64 @@ impl Error { } impl From for Error { - fn from(value: LanguageError) -> Self { - Error::External(value.to_string()) + fn from(error: LanguageError) -> Self { + Error::External(error.to_string()) } } impl From> for Error { - fn from(value: PoisonError) -> Self { - Error::External(value.to_string()) + fn from(error: PoisonError) -> Self { + Error::External(error.to_string()) } } impl From for Error { - fn from(value: FromUtf8Error) -> Self { - Error::External(value.to_string()) + fn from(error: FromUtf8Error) -> Self { + Error::External(error.to_string()) } } impl From for Error { - fn from(value: ParseFloatError) -> Self { - Error::External(value.to_string()) + fn from(error: ParseFloatError) -> Self { + Error::ParseFloat { + reason: error.to_string(), + } } } impl From for Error { - fn from(value: csv::Error) -> Self { - Error::External(value.to_string()) + fn from(error: csv::Error) -> Self { + Error::External(error.to_string()) } } impl From for Error { - fn from(value: std::io::Error) -> Self { - Error::External(value.to_string()) + fn from(error: std::io::Error) -> Self { + Error::External(error.to_string()) } } impl From for Error { - fn from(value: reqwest::Error) -> Self { - Error::External(value.to_string()) + fn from(error: reqwest::Error) -> Self { + Error::External(error.to_string()) } } impl From for Error { - fn from(value: serde_json::Error) -> Self { - Error::SerdeJson(value.to_string()) + fn from(error: serde_json::Error) -> Self { + Error::SerdeJson(error.to_string()) } } impl From for Error { - fn from(value: time::SystemTimeError) -> Self { - Error::External(value.to_string()) + fn from(error: time::SystemTimeError) -> Self { + Error::External(error.to_string()) } } impl From for Error { - fn from(value: toml::de::Error) -> Self { - Error::External(value.to_string()) + fn from(error: toml::de::Error) -> Self { + Error::External(error.to_string()) } }