Implement std::error::Error for GDError

This commit is contained in:
CosminPerRam 2023-01-13 01:00:31 +02:00
parent e72d7bdf8b
commit 3928d3a818

View file

@ -1,5 +1,7 @@
//! The library's possible errors.
use std::fmt;
use std::{fmt::Formatter, error::Error};
/// Result of Type and GDError.
pub type GDResult<T> = Result<T, GDError>;
@ -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)
}
}