From fdd7525e5a0d298ebb8a9aa81cc19ec79e8cd113 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 17 Nov 2022 21:20:09 +0100 Subject: added --clean for update && list downloadfolder --- src/error.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/error.rs (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..c82688c --- /dev/null +++ b/src/error.rs @@ -0,0 +1,34 @@ +use core::fmt; + +pub type MLE = Result; + +#[derive(Debug)] +pub struct MLError { + etype: ErrorType, + message: String, +} + +#[derive(Debug)] +pub enum ErrorType { + ArgumentError +} + +impl std::error::Error for MLError { + fn description(&self) -> &str { + &self.message + } +} + +impl fmt::Display for MLError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.etype { + ErrorType::ArgumentError => write!(f, "ARGS") + } + } +} + +impl MLError { + pub fn new(etype: ErrorType, message: &str) -> Self { + Self { etype, message: String::from(message) } + } +} -- cgit v1.2.3