From e1c79889d3bf02c8d131d642fed8ba7ef9521bf4 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Tue, 27 Dec 2022 11:46:22 +0100 Subject: some error stuff; version update --- src/error.rs | 4 +++- src/main.rs | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/error.rs b/src/error.rs index 1ac2a48..192aa76 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,6 +12,7 @@ pub struct MLError { #[derive(Debug, Deserialize)] pub enum ErrorType { ArgumentError, + ArgumentCountError, ConfigError, LibToml, IoError, @@ -26,7 +27,8 @@ impl std::error::Error for MLError { impl fmt::Display for MLError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.etype { - ErrorType::ArgumentError => write!(f, "ARGS"), + ErrorType::ArgumentError => write!(f, "Wrong argument"), + ErrorType::ArgumentCountError => write!(f, "Too many/too few arguments"), ErrorType::ConfigError => write!(f, "CONFIG"), ErrorType::LibToml => write!(f, "TOML"), ErrorType::IoError => write!(f, "IO") diff --git a/src/main.rs b/src/main.rs index a093bb7..a8aa15d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,10 @@ use modlist::{config::Cfg, input::get_input}; #[tokio::main] async fn main() { let config = Cfg::init("config.toml").unwrap(); - //TODO Error Handling - get_input(config).await.unwrap(); + match get_input(config).await { + Ok(..) => (), + Err(e) => { + println!("{}", e); + } + }; } -- cgit v1.2.3