BlueGit

ict rusty-teams

Files

rusty-teams / crates / core / src / error.rs

error.rs

error.rs 1.1 KiB Download Raw
1pub type Result<T> = std::result::Result<T, Error>;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5 #[error(transparent)]
6 Graph(#[from] graph::Error),
7 #[error(transparent)]
8 Store(#[from] store::Error),
9 #[error("cannot write the file: {0}")]
10 Io(#[from] std::io::Error),
11 #[error("folder service: {0}")]
12 Folders(String),
13 #[error("unknown conversation {0}")]
14 UnknownConversation(String),
15 #[error("GIFs are disabled by the organization")]
16 GifsDisabled,
17 #[error("{0} is not supported yet")]
18 Unsupported(&'static str),
19 #[error("banner image: {0}")]
20 BannerImage(&'static str),
21 /// The post is out; only its banner card could not be set.
22 #[error("posted without the banner")]
23 PostedWithoutBanner,
24}
25
26impl From<chatsvc::Error> for Error {
27 fn from(error: chatsvc::Error) -> Self {
28 match error {
29 chatsvc::Error::Session(inner) => Error::Graph(graph::Error::Session(inner)),
30 chatsvc::Error::GifsDisabled => Error::GifsDisabled,
31 other => Error::Folders(other.to_string()),
32 }
33 }
34}