indy_blssignatures/
error.rs1use std::fmt::{self, Display, Formatter};
2
3#[derive(Clone, Debug, PartialEq, Eq)]
4pub struct Error(&'static str);
6
7impl Error {
8 pub fn new(msg: &'static str) -> Self {
10 Self(msg)
11 }
12}
13
14impl Display for Error {
15 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
16 f.write_str(self.0)
17 }
18}
19
20pub type Result<T> = ::core::result::Result<T, Error>;
22
23#[macro_export]
25macro_rules! err_msg {
26 ($msg:expr, $($args:tt)+) => {
27 $crate::error::Error::new($crate::error::ErrorKind::$type, format!($msg, $($args)+))
28 };
29 ($msg:expr) => {{
30 $crate::error::Error::new($msg)
31 }};
32}