use std::error::Error as StdError;
use std::fmt;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum InsertPushRuleError {
#[error("rule IDs starting with a dot are reserved for server-default rules")]
ServerDefaultRuleId,
#[error("invalid rule ID")]
InvalidRuleId,
#[error("can't place rule relative to server-default rule")]
RelativeToServerDefaultRule,
#[error("The before or after rule could not be found")]
UnknownRuleId,
#[error("before has a higher priority than after")]
BeforeHigherThanAfter,
}
#[derive(Debug, Error)]
#[non_exhaustive]
#[error("The rule could not be found")]
pub struct RuleNotFoundError;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum RemovePushRuleError {
#[error("server-default rules cannot be removed")]
ServerDefault,
#[error("rule not found")]
NotFound,
}
#[derive(Debug)]
pub struct MissingPatternError;
impl fmt::Display for MissingPatternError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Push rule does not have a pattern.")
}
}
impl StdError for MissingPatternError {}