Skip to content

Provide an impl error::Error for FromPlantumlError #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{convert, io, string};
use std::{convert, error, fmt, io, string};

/// If error appear, the crate always faults to error type `FromPlantumlError`.
/// All other error types converted to this one.
Expand Down Expand Up @@ -26,3 +26,11 @@ impl convert::From<hex::FromHexError> for FromPlantumlError {
FromPlantumlError(format!("there is a problem during hex decoding: `{}`", err))
}
}

impl error::Error for FromPlantumlError {}

impl fmt::Display for FromPlantumlError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}