Skip to main content

tokio_valkey/
err.rs

1use core::{error, fmt};
2use std::{io, result};
3
4pub type Result<T> = result::Result<T, Error>;
5
6/// A Valkey error.
7#[derive(Debug)]
8pub enum Error {
9    Io(std::io::Error),
10    Custom(String),
11}
12
13impl From<io::Error> for Error {
14    fn from(e: io::Error) -> Self {
15        Error::Io(e)
16    }
17}
18
19impl error::Error for Error {}
20
21impl fmt::Display for Error {
22    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
23        write!(f, "Valkey error")
24    }
25}