Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Annotate thiserror for sp_core::crypto::SecretStringError (#13144)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl authored and Ross Bulat committed Feb 3, 2023
1 parent 8009b5c commit d8b34c4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions primitives/core/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,27 @@ impl<S, T: UncheckedFrom<S>> UncheckedInto<T> for S {
}

/// An error with the interpretation of a secret.
#[cfg_attr(feature = "std", derive(thiserror::Error))]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg(feature = "full_crypto")]
pub enum SecretStringError {
/// The overall format was invalid (e.g. the seed phrase contained symbols).
#[cfg_attr(feature = "std", error("Invalid format"))]
InvalidFormat,
/// The seed phrase provided is not a valid BIP39 phrase.
#[cfg_attr(feature = "std", error("Invalid phrase"))]
InvalidPhrase,
/// The supplied password was invalid.
#[cfg_attr(feature = "std", error("Invalid password"))]
InvalidPassword,
/// The seed is invalid (bad content).
#[cfg_attr(feature = "std", error("Invalid seed"))]
InvalidSeed,
/// The seed has an invalid length.
#[cfg_attr(feature = "std", error("Invalid seed length"))]
InvalidSeedLength,
/// The derivation path was invalid (e.g. contains soft junctions when they are not supported).
#[cfg_attr(feature = "std", error("Invalid path"))]
InvalidPath,
}

Expand Down

0 comments on commit d8b34c4

Please sign in to comment.