From 202ed4fcaa69e7de23e83fab0bae4ced6209eee4 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Tue, 2 May 2023 20:37:23 +0200 Subject: added config option for default mc version changed version input system --- src/error.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index bd6e3da..e6afeaa 100644 --- a/src/error.rs +++ b/src/error.rs @@ -20,6 +20,7 @@ pub enum ErrorType { LibSql, LibReq, LibChrono, + LibJson, IoError, Other, } @@ -42,6 +43,7 @@ impl fmt::Display for MLError { ErrorType::LibSql => write!(f, "SQL: {}", self.message), ErrorType::LibReq => write!(f, "REQWEST"), ErrorType::LibChrono => write!(f, "Chrono error: {}", self.message), + ErrorType::LibJson => write!(f, "JSON: {}", self.message), ErrorType::IoError => write!(f, "IO"), ErrorType::Other => write!(f, "OTHER"), } @@ -102,6 +104,13 @@ impl From for MLError { } } +impl From for MLError { + fn from(value: serde_json::error::Error) -> Self { + Self { etype: ErrorType::LibJson, message: value.to_string() } + } + +} + impl MLError { pub fn new(etype: ErrorType, message: &str) -> Self { Self { -- cgit v1.2.3