diff --git a/src/errors.rs b/src/errors.rs index ca360cf..afefef1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,10 +1,12 @@ //! The library's possible errors. +use std::fmt; +use std::{fmt::Formatter, error::Error}; /// Result of Type and GDError. pub type GDResult = Result; -/// GameDigError. +/// GameDig Error. #[derive(Debug, Clone)] pub enum GDError { /// The received packet was bigger than the buffer size. @@ -38,3 +40,11 @@ pub enum GDError { /// Couldn't parse a value. TypeParse, } + +impl Error for GDError {} + +impl fmt::Display for GDError { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!(f, "{:?}", self) + } +}