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