BlueGit

ict rusty-teams

Files

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

error.rs

error.rs 910 B 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}
20
21impl From<chatsvc::Error> for Error {
22 fn from(error: chatsvc::Error) -> Self {
23 match error {
24 chatsvc::Error::Session(inner) => Error::Graph(graph::Error::Session(inner)),
25 chatsvc::Error::GifsDisabled => Error::GifsDisabled,
26 other => Error::Folders(other.to_string()),
27 }
28 }
29}