use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ShardCountError {
pub(crate) requested: usize,
pub(crate) max_allowed: usize,
}
impl ShardCountError {
pub fn requested(&self) -> usize {
self.requested
}
pub fn max_allowed(&self) -> usize {
self.max_allowed
}
}
impl fmt::Display for ShardCountError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"requested shard_count {} exceeds max allowed {}",
self.requested, self.max_allowed
)
}
}
impl std::error::Error for ShardCountError {}