rustywallet_mnemonic/
error.rs

1//! Error types for mnemonic operations.
2
3use thiserror::Error;
4
5/// Errors that can occur during mnemonic operations.
6#[derive(Debug, Clone, PartialEq, Eq, Error)]
7pub enum MnemonicError {
8    /// Invalid word count (must be 12, 15, 18, 21, or 24)
9    #[error("Invalid word count: {0}. Must be 12, 15, 18, 21, or 24")]
10    InvalidWordCount(usize),
11
12    /// Word not found in wordlist
13    #[error("Invalid word: '{0}' not in wordlist")]
14    InvalidWord(String),
15
16    /// Checksum validation failed
17    #[error("Invalid checksum")]
18    InvalidChecksum,
19
20    /// Invalid entropy length
21    #[error("Invalid entropy length: expected {expected}, got {actual}")]
22    InvalidEntropyLength { expected: usize, actual: usize },
23
24    /// Empty mnemonic phrase
25    #[error("Empty mnemonic phrase")]
26    EmptyPhrase,
27
28    /// Invalid private key derived from seed
29    #[error("Invalid private key derived from seed")]
30    InvalidPrivateKey,
31
32    /// Language detection failed - words from multiple languages or unknown words
33    #[error("Could not detect language: words may be from multiple languages")]
34    LanguageDetectionFailed,
35}