core_crypto/error/
cryptobox_migration.rs1#![allow(missing_docs)]
3
4pub type CryptoboxMigrationError = super::WrappedContextualError<CryptoboxMigrationErrorKind>;
5
6#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
7pub enum CryptoboxMigrationErrorKind {
9 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
10 #[error(transparent)]
11 RexieError(rexie::Error),
13 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
14 #[error(transparent)]
15 IdbError(idb::Error),
17 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
18 #[error(transparent)]
19 JsonParseError(#[from] serde_wasm_bindgen::Error),
21 #[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
22 #[error(transparent)]
23 Base64DecodeError(#[from] base64::DecodeError),
25 #[error("The targeted value does not possess the targeted key ({0})")]
26 MissingKeyInValue(String),
28 #[error("The value cannot be coerced to the {0} type")]
29 WrongValueType(String),
31 #[cfg_attr(target_family = "wasm", error("The provided path [{0}] could not be found."))]
32 #[cfg_attr(
33 not(target_family = "wasm"),
34 error("The provided path store [{0}] is either non-existent or has an incorrect shape.")
35 )]
36 ProvidedPathDoesNotExist(String),
38 #[error("The Cryptobox identity at path [{0}] could not be found.")]
39 IdentityNotFound(String),
41 #[cfg(all(feature = "cryptobox-migrate", not(target_family = "wasm")))]
42 #[error(transparent)]
43 Io(#[from] std::io::Error),
44 #[cfg(feature = "cryptobox-migrate")]
45 #[error(transparent)]
46 ParseInt(#[from] std::num::ParseIntError),
47}
48
49#[cfg(all(feature = "cryptobox-migrate", target_family = "wasm"))]
50impl From<rexie::Error> for CryptoboxMigrationErrorKind {
51 fn from(e: rexie::Error) -> Self {
52 match e {
53 rexie::Error::IdbError(e) => Self::IdbError(e),
54 _ => Self::RexieError(e),
55 }
56 }
57}