diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-27 13:10:06 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-27 15:17:59 -0500 |
commit | 2bb014f580863f28ecbbea68a2b0aeaa815dc8ca (patch) | |
tree | 235397a0d50f76fa906697eb1279f10905398cbd | |
parent | 0a31f6bcd806eeaf1fcfddbcfbd466db969ed006 (diff) | |
download | teleterm-2bb014f580863f28ecbbea68a2b0aeaa815dc8ca.tar.gz teleterm-2bb014f580863f28ecbbea68a2b0aeaa815dc8ca.zip |
better error messages
-rw-r--r-- | teleterm/src/error.rs | 20 | ||||
-rw-r--r-- | teleterm/src/oauth.rs | 2 |
2 files changed, 20 insertions, 2 deletions
diff --git a/teleterm/src/error.rs b/teleterm/src/error.rs index f7946dd..d75aea3 100644 --- a/teleterm/src/error.rs +++ b/teleterm/src/error.rs @@ -74,7 +74,10 @@ pub enum Error { #[snafu(display("received EOF from server"))] EOF, - #[snafu(display("failed to retrieve access token: {:?}", msg))] + #[snafu(display( + "failed to retrieve access token from authorization code: {:?}", + msg + ))] ExchangeCode { msg: String, // XXX RequestTokenError doesn't implement the right traits @@ -87,6 +90,21 @@ pub enum Error { }, #[snafu(display( + "failed to retrieve access token from refresh token: {:?}", + msg + ))] + ExchangeRefreshToken { + msg: String, + // XXX RequestTokenError doesn't implement the right traits + // source: oauth2::RequestTokenError< + // oauth2::reqwest::Error, + // oauth2::StandardErrorResponse< + // oauth2::basic::BasicErrorResponseType, + // >, + // > + }, + + #[snafu(display( "failed to parse string {:?}: unexpected trailing data", data ))] diff --git a/teleterm/src/oauth.rs b/teleterm/src/oauth.rs index 1229855..0d55a9f 100644 --- a/teleterm/src/oauth.rs +++ b/teleterm/src/oauth.rs @@ -71,7 +71,7 @@ pub trait Oauth { .request_async(oauth2::reqwest::async_http_client) .map_err(|e| { let msg = stringify_oauth2_http_error(&e); - Error::ExchangeCode { msg } + Error::ExchangeRefreshToken { msg } }) .and_then(|token| { let access_token = token.access_token().secret().to_string(); |