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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use keri_core::{
    actor::prelude::VersionError, event_message::cesr_adapter::ParseError, oobi::Scheme,
    prefix::IdentifierPrefix, processor::validator::VerificationError,
};
use thiserror::Error;

use crate::{
    communication::SendingError,
    identifier::{mechanics::MechanicsError, query::WatcherResponseError},
};

#[derive(Error, Debug)]
pub enum ControllerError {
    #[error("Database error: {0}")]
    DatabaseError(#[from] keri_core::database::DbError),

    #[error(transparent)]
    SendingError(#[from] SendingError),

    #[error("Keri event parsing error: {0}")]
    ParseError(#[from] ParseError),

    #[error("Unknown identifier")]
    UnknownIdentifierError,

    #[error("transparent")]
    EventProcessingError(#[from] keri_core::error::Error),

    #[error("Keri version error: ")]
    VersionError(#[from] VersionError),

    #[error("No location for {id} with {scheme:?}")]
    NoLocationScheme {
        id: IdentifierPrefix,
        scheme: Scheme,
    },

    #[error("Query error: {0}")]
    QueryArgumentError(String),

    #[error("Cesr error")]
    CesrFormatError,

    #[error("Wrong signature")]
    FaultySignature,

    #[error("Verification failed for following elements: {0:?}")]
    VerificationError(Vec<(VerificationError, String)>),

    #[error(transparent)]
    TelError(#[from] teliox::error::Error),

    #[error("Error: {0}")]
    OtherError(String),

    #[error(transparent)]
    Mechanic(#[from] MechanicsError),

    #[error("Watcher response error: {0}")]
    WatcherResponseError(#[from] WatcherResponseError),
}