From 3059a3b77492be751cba36d012557bd9622c62a7 Mon Sep 17 00:00:00 2001 From: KitsuneCafe <10284516+kitsunecafe@users.noreply.github.com> Date: Sun, 4 Feb 2024 06:35:02 -0500 Subject: [PATCH] add constructor for error --- src/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/error.rs b/src/error.rs index 3c938cc..cd4daac 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,6 +12,13 @@ pub struct Error { } impl Error { + pub fn new(message: String, source: E) -> Self { + Self { + message, + source: Some(Box::new(source)), + } + } + fn wrap(value: E) -> Option> { Some(Box::new(value)) }