From f698687a2d1a8b7501d4606df509cc2f138a4ff2 Mon Sep 17 00:00:00 2001 From: KitsuneCafe <10284516+kitsunecafe@users.noreply.github.com> Date: Sun, 4 Feb 2024 06:09:58 -0500 Subject: [PATCH] fromutf8error convert --- src/error.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/error.rs b/src/error.rs index ea6b5eb..3c938cc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -2,6 +2,7 @@ use std::{ fmt::Display, io::{Error as IOError, ErrorKind}, path::StripPrefixError, + string::FromUtf8Error, }; #[derive(Debug)] @@ -67,6 +68,15 @@ impl From for IOError { } } +impl From for Error { + fn from(value: FromUtf8Error) -> Self { + Self { + message: value.to_string(), + source: Self::wrap(value), + } + } +} + impl From<&'static dyn std::error::Error> for Error { fn from(value: &'static dyn std::error::Error) -> Self { Self {