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
62
63
64
65
66
67
68
69
70
71
72
73
use thiserror::Error;

use crate::{commons::errors::SubjectError, governance::error::RequestError};

#[derive(Error, Clone, Debug)]
pub enum EventError {
    #[error("Event API channel not available")]
    EventApiChannelNotAvailable,
    #[error("A database error has ocurred at main component {0}")]
    DatabaseError(String),
    #[error("Governance Error: {0}")]
    GovernanceError(#[from] RequestError),
    #[error("Subject Error: {0}")]
    SubjectError(#[from] SubjectError),
    #[error("Crypto Error")]
    CryptoError(String),
    #[error("Cant send message. Channel closed")]
    ChannelClosed,
    #[error("Subject has already an Event Completing")]
    EventAlreadyInProgress,
    #[error("Subject for state request not found")]
    SubjectNotFound(String),
    #[error("Event phase doesn't match")]
    WrongEventPhase,
    #[error("Governance version of evaluator doesn't match with ours")]
    WrongGovernanceVersion,
    #[error("Evaluation in Creation Event")]
    EvaluationOrApprovationInCreationEvent,
    #[error("Error parsing json string: {0}")]
    ErrorParsingJsonString(String),
    #[error("Error parsing value")]
    ErrorParsingValue,
    #[error("Error applying patch json string: {0}")]
    ErrorApplyingPatch(String),
    #[error("Channel unnavaible")]
    ChannelError(#[from] crate::commons::errors::ChannelErrors),
    #[error("Subject Not Owned: {0}")]
    SubjectNotOwned(String),
    #[error("External Genesis Event")]
    ExternalGenesisEvent,
    #[error("Creating Permission Denied")]
    CreatingPermissionDenied,
    #[error("Genesis In Gov Update:")]
    GenesisInGovUpdate,
    #[error("Transfer events are not evaluated")]
    NoEvaluationForTransferEvents,
    #[error("Transfer events are not approved")]
    NoApprovalForTransferEvents,
    #[error("EOL events are not evaluated")]
    NoEvaluationForEOLEvents,
    #[error("EOL events are not approved")]
    NoApprovalForEOLEvents,
    #[error("KeyID: {0}, not authorized for close")]
    CloseNotAuthorized(String),
    #[error("Subject Life Ended: {0}")]
    SubjectLifeEnd(String),
    #[error("Invoke permission denied for ID: {0}, Subject ID: {1}")]
    InvokePermissionDenied(String, String),
    #[error("Hash generation failed")]
    HashGenerationFailed,
    #[error("Request already known")]
    RequestAlreadyKnown,
    #[error("Subject Keys Not Found")]
    SubjectKeysNotFound(String),
    #[error("Event0 Not Create")]
    Event0NotCreate,
    #[error("Own Transfer Keys Db Error")]
    OwnTransferKeysDbError,
    #[error("Approval Required When Eval Failed")]
    ApprovalRequiredWhenEvalFailed,
    #[error("Invalid specify public key")]
    PublicKeyIsEmpty,
}