core_crypto/error/
cryptobox_migration.rs1#![allow(missing_docs)]
19
20pub type CryptoboxMigrationError = super::WrappedContextualError<CryptoboxMigrationErrorKind>;
21
22#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
23pub enum CryptoboxMigrationErrorKind {
25 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
26 #[error(transparent)]
27 RexieError(rexie::Error),
29 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
30 #[error(transparent)]
31 IdbError(idb::Error),
33 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
34 #[error(transparent)]
35 JsonParseError(#[from] serde_wasm_bindgen::Error),
37 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
38 #[error(transparent)]
39 Base64DecodeError(#[from] base64::DecodeError),
41 #[error("The targeted value does not possess the targeted key ({0})")]
42 MissingKeyInValue(String),
44 #[error("The value cannot be coerced to the {0} type")]
45 WrongValueType(String),
47 #[cfg_attr(target_family = "wasm", error("The provided path [{0}] could not be found."))]
48 #[cfg_attr(
49 not(target_family = "wasm"),
50 error("The provided path store [{0}] is either non-existent or has an incorrect shape.")
51 )]
52 ProvidedPathDoesNotExist(String),
54 #[error("The Cryptobox identity at path [{0}] could not be found.")]
55 IdentityNotFound(String),
57 #[cfg(all(feature = "cryptobox-migrate", not(target_family = "wasm")))]
58 #[error(transparent)]
59 Io(#[from] std::io::Error),
60 #[cfg(feature = "cryptobox-migrate")]
61 #[error(transparent)]
62 ParseInt(#[from] std::num::ParseIntError),
63}
64
65#[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
66impl From<rexie::Error> for CryptoboxMigrationErrorKind {
67 fn from(e: rexie::Error) -> Self {
68 match e {
69 rexie::Error::IdbError(e) => Self::IdbError(e),
70 _ => Self::RexieError(e),
71 }
72 }
73}