1use serde::Deserialize;
2
3use crate::permission::{Permission, UserPermission};
4
5#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11#[serde(tag = "type")]
12pub enum ApiError {
13 LabelMe,
14
15 AlreadyOnboarded,
17
18 UsernameTaken,
20 InvalidUsername,
21 UnknownUser,
22 AlreadyFriends,
23 AlreadySentRequest,
24 Blocked,
25 BlockedByOther,
26 NotFriends,
27
28 UnknownChannel,
30 UnknownAttachment,
31 UnknownMessage,
32 CannotEditMessage,
33 CannotJoinCall,
34 TooManyAttachments,
35 TooManyReplies,
36 EmptyMessage,
37 PayloadTooLarge,
38 CannotRemoveYourself,
39 GroupTooLarge { max: usize },
40 AlreadyInGroup,
41 NotInGroup,
42
43 UnknownServer,
45 InvalidRole,
46 Banned,
47 TooManyServers { max: usize },
48 TooManyEmoji,
49
50 ReachedMaximumBots,
52 IsBot,
53 BotIsPrivate,
54
55 MissingPermission { permission: Permission },
57 MissingUserPermission { permission: UserPermission },
58 NotElevated,
59 CannotGiveMissingPermissions,
60 NotOwner,
61
62 DatabaseError { operation: String, with: String },
64 InternalError,
65 InvalidOperation,
66 InvalidCredentials,
67 InvalidSession,
68 DuplicateNonce,
69 VosoUnavailable,
70 NotFound,
71 NoEffect,
72 FailedValidation,
73
74 Unauthenticated,
76}
77
78#[derive(Deserialize, Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
80#[serde(tag = "type")]
81pub enum AutumnError {
82 FileTooLarge { max_size: usize },
83 FileTypeNotAllowed,
84 FailedToReceive,
85 BlockingError,
86 DatabaseError,
87 MissingData,
88 UnknownTag,
89 ProbeError,
90 NotFound,
91 Malware,
92 IOError,
93 S3Error,
94 LabelMe,
95}