trustcaptcha_rust/
errors.rs1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct VerificationTokenInvalidError;
6
7impl fmt::Display for VerificationTokenInvalidError {
8 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9 write!(f, "Invalid verification token")
10 }
11}
12
13impl Error for VerificationTokenInvalidError {}
14
15#[derive(Debug)]
16pub struct VerificationNotFoundError;
17
18impl fmt::Display for VerificationNotFoundError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 write!(f, "Verification not found")
21 }
22}
23
24impl Error for VerificationNotFoundError {}
25
26#[derive(Debug)]
27pub struct SecretKeyInvalidError;
28
29impl fmt::Display for SecretKeyInvalidError {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 write!(f, "Secret key is invalid")
32 }
33}
34
35impl Error for SecretKeyInvalidError {}
36
37#[derive(Debug)]
38pub struct VerificationNotFinishedError;
39
40impl fmt::Display for VerificationNotFinishedError {
41 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42 write!(f, "Verification not finished")
43 }
44}
45
46impl Error for VerificationNotFinishedError {}
47
48#[derive(Debug)]
49pub struct UnknownError;
50
51impl fmt::Display for UnknownError {
52 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
53 write!(f, "An unknown error occurred")
54 }
55}
56
57impl Error for UnknownError {}