use thiserror::Error;
#[derive(Debug, Error, Clone, PartialEq, Eq)]
pub enum TaprootError {
#[error("invalid x-only public key")]
InvalidXOnlyKey,
#[error("invalid signature")]
InvalidSignature,
#[error("invalid tweak: {0}")]
InvalidTweak(String),
#[error("invalid leaf version: 0x{0:02x}")]
InvalidLeafVersion(u8),
#[error("invalid control block: {0}")]
InvalidControlBlock(String),
#[error("tree construction error: {0}")]
TreeError(String),
#[error("verification failed")]
VerificationFailed,
#[error("invalid script: {0}")]
InvalidScript(String),
#[error("invalid parity value")]
InvalidParity,
#[error("secp256k1 error: {0}")]
Secp256k1Error(String),
#[error("invalid length: expected {expected}, got {got}")]
InvalidLength { expected: usize, got: usize },
#[error("cannot build empty tree")]
EmptyTree,
#[error("invalid merkle path")]
InvalidMerklePath,
}