Skip to content

Commit

Permalink
Implement std::error::Error for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Mar 10, 2024
1 parent 992af50 commit 4f21027
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ impl<T> InvalidLength<T> {
}
}

#[cfg(feature = "std")]
impl<T: Debug> std::error::Error for InvalidLength<T> {}

impl<T> core::fmt::Display for InvalidLength<T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(
Expand All @@ -69,6 +72,9 @@ impl InvalidStrLength {
}
}

#[cfg(feature = "std")]
impl std::error::Error for InvalidStrLength {}

impl core::fmt::Display for InvalidStrLength {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(
Expand Down

0 comments on commit 4f21027

Please sign in to comment.