From 368a7999c1b19203f49d52080ec369fbd3a644e0 Mon Sep 17 00:00:00 2001 From: Jun Jiang Date: Sun, 15 Jan 2023 21:31:14 +0800 Subject: [PATCH] Annotate thiserror for sp_core::crypto::SecretStringError (#13144) --- substrate/primitives/core/src/crypto.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/substrate/primitives/core/src/crypto.rs b/substrate/primitives/core/src/crypto.rs index 06703acea7..52c805bb61 100644 --- a/substrate/primitives/core/src/crypto.rs +++ b/substrate/primitives/core/src/crypto.rs @@ -84,20 +84,27 @@ impl> UncheckedInto 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, }