raft_engine/
errors.rs
1use std::error;
4use std::io::Error as IoError;
5
6use thiserror::Error;
7
8use crate::codec::Error as CodecError;
9
10#[derive(Debug, Error)]
11pub enum Error {
12 #[error("Invalid Argument: {0}")]
13 InvalidArgument(String),
14 #[error("Corruption: {0}")]
15 Corruption(String),
16 #[error("IO Error: {0:?}")]
17 Io(#[from] IoError),
18 #[error("Codec Error: {0}")]
19 Codec(#[from] CodecError),
20 #[error("Protobuf Error: {0}")]
21 Protobuf(#[from] protobuf::ProtobufError),
22 #[error("TryAgain Error: {0}")]
23 TryAgain(String),
24 #[error("Entry Compacted")]
25 EntryCompacted,
26 #[error("Entry Not Found")]
27 EntryNotFound,
28 #[error("Full")]
29 Full,
30 #[error("Other Error: {0}")]
31 Other(#[from] Box<dyn error::Error + Send + Sync>),
32}
33
34pub type Result<T> = ::std::result::Result<T, Error>;
35
36pub(crate) fn is_no_space_err(e: &IoError) -> bool {
38 format!("{e}").contains("nospace")
41}