phabricator_oauth/
error.rs

1use thiserror::Error;
2
3use oauth2::{url::ParseError, reqwest::{Error as OAuthReqwestError, HttpClientError}, RequestTokenError, StandardErrorResponse, basic::BasicErrorResponseType};
4use serde_json::Error as SerdeJsonError;
5use std::string::FromUtf8Error;
6
7#[derive(Error, Debug)]
8pub enum PhabOAuthError {
9    #[error("Could not parse url")]
10    UrlParseError(#[from] ParseError),
11    #[error("Error during performing the oauth request")]
12    OAuthReqwestError(#[from] OAuthReqwestError<HttpClientError>),
13    #[error("Error during performing the request")]
14    ReqwestError(#[from] HttpClientError),
15    #[error("Error during performing the token request")]
16    RequestTokenError(#[from] RequestTokenError<HttpClientError, StandardErrorResponse<BasicErrorResponseType>>),
17    #[error("Could not serialize/deserialize JSON")]
18    SerdeJsonError(#[from] SerdeJsonError),
19    #[error("Could not read response body as utf-8 text")]
20    FromUtf8Error(#[from] FromUtf8Error)
21}