diff options
Diffstat (limited to 'src/errors.rs')
| -rw-r--r-- | src/errors.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs index 251ee5f..6b53c2d 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -28,6 +28,9 @@ pub enum Error { #[from] TomlSerError(toml::ser::Error), + + #[from] + ParseIntError(std::num::ParseIntError), } impl core::fmt::Display for Error { @@ -44,6 +47,7 @@ impl core::fmt::Display for Error { Error::SerdeError(e) => write!(fmt, "Serde error: {e}"), Error::TomlDeError(e) => write!(fmt, "TOML deserialization error: {e}"), Error::TomlSerError(e) => write!(fmt, "TOML serialization error: {e}"), + Error::ParseIntError(e) => write!(fmt, "Parsing error: {e}"), } } } @@ -80,6 +84,10 @@ impl IntoResponse for Error { StatusCode::INTERNAL_SERVER_ERROR, format!("TOML serialization error: {e}"), ), + Error::ParseIntError(ref e) => ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("Parsing error: {e}"), + ), }; println!("{} {}", &status, &error_message); |
