mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-19 07:53:54 +01:00
27 lines
581 B
Rust
27 lines
581 B
Rust
use serde::{Serialize, Serializer};
|
|
use std::io;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum Error {
|
|
#[error("Rustls error: {0}")]
|
|
RustlsError(#[from] rustls::Error),
|
|
|
|
#[error("I/O error: {0}")]
|
|
IOError(#[from] io::Error),
|
|
|
|
#[error("TLS error: {0}")]
|
|
GenericError(String),
|
|
}
|
|
|
|
impl Serialize for Error {
|
|
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
|
where
|
|
S: Serializer,
|
|
{
|
|
serializer.serialize_str(self.to_string().as_ref())
|
|
}
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|