1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use ockam_core::Error;

/// Represents the failures that can occur in
/// an Ockam vault sync core
#[derive(Clone, Copy, Debug)]
pub enum VaultSyncCoreError {
    /// No error.
    None,
    /// Invalid response type.
    InvalidResponseType,
}

impl VaultSyncCoreError {
    /// Integer code associated with the error domain.
    pub const DOMAIN_CODE: u32 = 17_000;
    /// Descriptive name for the error domain.
    pub const DOMAIN_NAME: &'static str = "OCKAM_VAULT_SYNC_CORE";
}

impl From<VaultSyncCoreError> for Error {
    fn from(err: VaultSyncCoreError) -> Self {
        Self::new(
            VaultSyncCoreError::DOMAIN_CODE + (err as u32),
            VaultSyncCoreError::DOMAIN_NAME,
        )
    }
}