b3_core/errors.rs
1use std::fmt;
2
3/// This structure represents an internal error.
4///
5/// You can intercept this error and override the behavior in case of a failure.
6#[derive(Debug, Clone)]
7pub struct Error(String);
8
9impl Error {
10 pub(crate) fn new<S>(msg: S) -> Self
11 where
12 S: Into<String>,
13 {
14 Self(msg.into())
15 }
16}
17
18impl fmt::Display for Error {
19 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self.0) }
20}