1use std::{any::Any, result};
2
3use thiserror::Error;
4
5use crate::{AnyBoxedError, AnyError};
6
7pub type Result<T> = result::Result<T, Error>;
9
10#[derive(Debug, Error)]
12pub enum Error {
13 #[error("cannot add folder: feature not available, or backend configuration for this functionality is not set")]
14 AddFolderNotAvailableError,
15 #[error("cannot list folders: feature not available, or backend configuration for this functionality is not set")]
16 ListFoldersNotAvailableError,
17 #[error("cannot expunge folder: feature not available, or backend configuration for this functionality is not set")]
18 ExpungeFolderNotAvailableError,
19 #[error("cannot purge folder: feature not available, or backend configuration for this functionality is not set")]
20 PurgeFolderNotAvailableError,
21 #[error("cannot delete folder: feature not available, or backend configuration for this functionality is not set")]
22 DeleteFolderNotAvailableError,
23 #[error("cannot list envelopes: feature not available, or backend configuration for this functionality is not set")]
24 ListEnvelopesNotAvailableError,
25 #[error("cannot thread envelopes: feature not available, or backend configuration for this functionality is not set")]
26 ThreadEnvelopesNotAvailableError,
27 #[error("cannot watch for envelopes changes: feature not available, or backend configuration for this functionality is not set")]
28 WatchEnvelopesNotAvailableError,
29 #[error("cannot get envelope: feature not available, or backend configuration for this functionality is not set")]
30 GetEnvelopeNotAvailableError,
31 #[error("cannot add flag(s): feature not available, or backend configuration for this functionality is not set")]
32 AddFlagsNotAvailableError,
33 #[error("cannot set flag(s): feature not available, or backend configuration for this functionality is not set")]
34 SetFlagsNotAvailableError,
35 #[error("cannot remove flag(s): feature not available, or backend configuration for this functionality is not set")]
36 RemoveFlagsNotAvailableError,
37 #[error("cannot add message: feature not available, or backend configuration for this functionality is not set")]
38 AddMessageNotAvailableError,
39 #[error("cannot add message with flags: feature not available, or backend configuration for this functionality is not set")]
40 AddMessageWithFlagsNotAvailableError,
41 #[error("cannot send message: feature not available, or backend configuration for this functionality is not set")]
42 SendMessageNotAvailableError,
43 #[error("cannot get messages: feature not available, or backend configuration for this functionality is not set")]
44 GetMessagesNotAvailableError,
45 #[error("cannot peek messages: feature not available, or backend configuration for this functionality is not set")]
46 PeekMessagesNotAvailableError,
47 #[error("cannot copy messages: feature not available, or backend configuration for this functionality is not set")]
48 CopyMessagesNotAvailableError,
49 #[error("cannot move messages: feature not available, or backend configuration for this functionality is not set")]
50 MoveMessagesNotAvailableError,
51 #[error("cannot delete messages: feature not available, or backend configuration for this functionality is not set")]
52 DeleteMessagesNotAvailableError,
53 #[error("cannot remove messages: feature not available, or backend configuration for this functionality is not set")]
54 RemoveMessagesNotAvailableError,
55}
56
57impl AnyError for Error {
58 fn as_any(&self) -> &dyn Any {
59 self
60 }
61}
62
63impl From<Error> for AnyBoxedError {
64 fn from(err: Error) -> Self {
65 Box::new(err)
66 }
67}