octra_sqlite/protocol/
error.rs1use std::fmt;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct Error {
11 message: String,
12}
13
14impl Error {
15 pub fn new(message: impl Into<String>) -> Self {
17 Self {
18 message: message.into(),
19 }
20 }
21}
22
23impl fmt::Display for Error {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 f.write_str(&self.message)
26 }
27}
28
29impl std::error::Error for Error {}
30
31impl From<base64::DecodeError> for Error {
32 fn from(error: base64::DecodeError) -> Self {
33 Self::new(error.to_string())
34 }
35}