use thiserror::Error; #[derive(Error, Debug)] pub enum Error { #[error("Index is too large, must be less than 0x80000000: {0}")] IndexTooLarge(u32), #[error("Unable to parse integer for index")] IntParseError(#[from] std::num::ParseIntError), #[error("Unable to parse path due to bad path prefix")] UnknownPathPrefix, #[error("Seed length in bits must be divisible by 32")] BadSeedLength(usize), /// This should never happen. HMAC keys should be able to take any size input. #[error("Invalid length for HMAC key while generating master key (report me!)")] HmacInvalidLength(#[from] hmac::digest::InvalidLength), /// There's a 1 in 2^256 chance this will happen. If it does, I'm sorry. Pick a new mnemonic. #[error("Seed hash generated 32 bytes of zero, pick a new seed")] HashedSeedIsZero, } pub type Result = std::result::Result;