mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-27 04:07:25 +01:00
Move crates to toplevel directory
This commit is contained in:
parent
d16961efa8
commit
0ffe68e04f
127 changed files with 15 additions and 13 deletions
36
client/src/error.rs
Normal file
36
client/src/error.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
use isahc::http::StatusCode;
|
||||
|
||||
/// An error within the client.
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("The users login credentials were wrong.")]
|
||||
LoginFailed,
|
||||
|
||||
#[error("The user has to be logged in to perform this action.")]
|
||||
Unauthorized,
|
||||
|
||||
#[error("The user is not allowed to perform this action.")]
|
||||
Forbidden,
|
||||
|
||||
#[error("The server returned an unexpected status code: {0}.")]
|
||||
UnexpectedResponse(StatusCode),
|
||||
|
||||
#[error("A networking error happened.")]
|
||||
NetworkError(#[from] isahc::Error),
|
||||
|
||||
#[error("A networking error happened.")]
|
||||
HttpError(#[from] isahc::http::Error),
|
||||
|
||||
#[error("An error happened when serializing/deserializing.")]
|
||||
SerdeError(#[from] serde_json::Error),
|
||||
|
||||
#[error("An IO error happened.")]
|
||||
IoError(#[from] std::io::Error),
|
||||
|
||||
#[error("An error happened: {0}")]
|
||||
Other(&'static str),
|
||||
}
|
||||
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue