// SPDX-License-Identifier: GPL-3.0-or-later
use std::fmt;
#[derive(Debug)]
pub enum FBError {
/// Unable to decode the given data.
DecodeError,
/// The provided key is invalid w.r.t this False Bottom Object.
InvalidKey,
/// Keybase length (k) or Cipher length (n) out of bounds.
/// Valid bounds: (2 <= k <= n).
InvalidParams,
}
impl fmt::Display for FBError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let message = match self {
FBError::DecodeError => "Invalid input",
FBError::InvalidKey => "Invalid Key used",
FBError::InvalidParams => "Keybase len(k) or Cipher len(n) out of bounds. Valid bounds: (2 <= k <= n)",
};
f.write_fmt(format_args!("{message}"))
}
}
impl std::error::Error for FBError {}