use super::command::Command2;
use thiserror::Error;
#[derive(Debug, Clone, Error, PartialEq, Eq)]
pub enum ConsensusError {
#[error("invalid command: expected {expected:?}, found {found:?}")]
InvalidCommand { expected: Command2, found: Command2 },
#[error("invalid size: expected {expected:?}, found {found:?}")]
InvalidSize { expected: u32, found: u32 },
#[error("invalid checksum")]
InvalidChecksum,
#[error("invalid cluster ID")]
InvalidCluster,
#[error("invalid field: {0}")]
InvalidField(String),
#[error("parent_padding must be 0")]
PrepareParentPaddingNonZero,
#[error("request_checksum_padding must be 0")]
PrepareRequestChecksumPaddingNonZero,
#[error("command must be Commit")]
CommitInvalidCommand2,
#[error("size must be 256, found {0}")]
CommitInvalidSize(u32),
#[error("command must be Reply")]
ReplyInvalidCommand2,
#[error("request_checksum_padding must be 0")]
ReplyRequestChecksumPaddingNonZero,
#[error("context_padding must be 0")]
ReplyContextPaddingNonZero,
#[error("invalid bit pattern in header (enum discriminant out of range)")]
InvalidBitPattern,
#[error("client-bound command {0:?} cannot be dispatched on inbound path")]
ClientBoundCommand(Command2),
}