svc_authn/
error.rs

1use std::error::Error as StdError;
2use std::fmt::{self, Display};
3
4////////////////////////////////////////////////////////////////////////////////
5
6#[derive(Debug)]
7pub struct Error(String);
8
9impl Error {
10    pub fn new(detail: &str) -> Self {
11        Self(detail.to_owned())
12    }
13}
14
15impl StdError for Error {}
16
17impl Display for Error {
18    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
19        fmt::Display::fmt(&self.0, fmt)
20    }
21}
22
23////////////////////////////////////////////////////////////////////////////////
24
25#[derive(Debug)]
26pub struct SerializationError(String);
27
28impl SerializationError {
29    pub fn new(detail: &str) -> Self {
30        Self(detail.to_owned())
31    }
32}
33
34impl StdError for SerializationError {}
35
36impl Display for SerializationError {
37    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
38        fmt::Display::fmt(&self.0, fmt)
39    }
40}