smart_id_rust_client/
error.rs1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, SmartIdClientError>;
4
5#[derive(Error, Debug)]
6#[non_exhaustive]
7#[allow(dead_code)]
8pub enum SmartIdClientError {
9 #[error("Configuration missing: {0}")]
11 ConfigMissingException(&'static str),
12
13 #[error("Serialization error: {0}")]
15 SerializationError(String),
16
17 #[error("Relying Party account configuration exception: {0}")]
19 RelyingPartyAccountConfigurationException(&'static str),
20
21 #[error("Smart ID client exception: {0}")]
23 SmartIdClientException(&'static str),
24
25 #[error("Smart ID API Exception: {0}")]
27 SmartIDAPIException(String),
28
29 #[error("Session timed out without getting any response from user")]
31 SessionTimeoutException,
32
33 #[error("There is no running session")]
35 NoSessionException,
36
37 #[error("Failed to get the running session")]
39 GetSessionException,
40
41 #[error("Failed to set the running session")]
43 SetSessionException,
44
45 #[error("Failed to get user identity")]
47 GetUserIdentityException,
48
49 #[error("Failed to set user identity")]
51 SetUserIdentityException,
52
53 #[error("Get signing certificate failed: {0}")]
55 GetSigningCertificateException(String),
56
57 #[error("Authentication session completed without result")]
59 AuthenticationSessionCompletedWithoutResult,
60
61 #[error("Session did not complete within timeout")]
63 StatusRequestLongPollingTimeoutException,
64
65 #[error("Session does not exist or has expired")]
67 SessionDoesNotExistOrHasExpired,
68
69 #[error("Api client is too old and is not supported anymore")]
71 ApiClientIsTooOldException,
72
73 #[error("System is under maintenance and is not available")]
75 SystemIsUnderMaintenanceException,
76
77 #[error("Session response missing certificate")]
79 SessionResponseMissingCertificate,
80
81 #[error("Session response missing signature")]
83 SessionResponseMissingSignature,
84
85 #[error("Session response missing interaction type")]
87 SessionResponseMissingInteractionType,
88
89 #[error("Session response signature verification failed: {0}")]
91 InvalidResponseSignature(String),
92
93 #[error("User has multiple accounts and pressed Cancel on device choice screen on any device")]
95 UserRefusedCertChoiceException,
96
97 #[error("User cancelled on confirmationMessage screen")]
99 UserRefusedConfirmationMessageException,
100
101 #[error("User cancelled on confirmationMessageAndVerificationCodeChoice screen")]
103 UserRefusedConfirmationMessageWithVerificationChoiceException,
104
105 #[error("User pressed Cancel on PIN screen")]
107 UserRefusedDisplayTextAndPinException,
108
109 #[error("User cancelled verificationCodeChoice screen")]
111 UserRefusedVerificationChoiceException,
112
113 #[error("User selected wrong verification code")]
115 UserSelectedWrongVerificationCodeException,
116
117 #[error("DOCUMENT_UNUSABLE. User must either check his/her Smart-ID mobile application or turn to customer support for getting the exact reason")]
119 DocumentUnusableException,
120
121 #[error("No suitable account of requested type found, but user has some other accounts")]
123 NoSuitableAccountOfRequestedTypeFoundException,
124
125 #[error("Person should view Smart-ID app or Smart-ID self-service portal now")]
127 PersonShouldViewSmartIdPortalException,
128
129 #[error("User app version does not support any of the allowedInteractionsOrder interactions")]
131 RequiredInteractionNotSupportedByAppException,
132
133 #[error("Interaction parameters are invalid: {0}")]
135 InvalidInteractionParametersException(&'static str),
136
137 #[error("Failed to generate device link: {0}")]
139 GenerateDeviceLinkException(&'static str),
140
141 #[error("Invalid signature protocol: {0}")]
143 InvalidSignatureProtocal(&'static str),
144
145 #[error("Failed to validate session response certificate: {0}")]
147 FailedToValidateSessionResponseCertificate(String),
148
149 #[error("Digest is not in valid format: {0}")]
151 InvalidDigestException(String),
152
153 #[error("User should view Smart-ID app or portal")]
155 UserShouldViewSmartIDAppOrPortalException,
156
157 #[error("Not found exception from Smart ID API")]
159 NotFoundException,
160
161 #[error("Bad request exception from Smart ID API")]
163 BadRequestException,
164
165 #[error("Smart ID client is outdated")]
167 ClientOutdatedException,
168
169 #[error("Invalid semantic identifier: {0}")]
171 InvalidSemanticIdentifierException(String),
172
173 #[error("Protocol failure exception")]
175 ProtocolFailureException,
176
177 #[error("Server error exception")]
179 ServerErrorException,
180}