From 7c045d7a259396bf1c4ce2b85415d1d3f7b858fa Mon Sep 17 00:00:00 2001 From: philippeitis <33013301+philippeitis@users.noreply.github.com> Date: Sat, 24 Sep 2022 12:13:30 -0700 Subject: [PATCH] Add yup-oauth2 error to auth error handling --- src/generator/templates/Cargo.toml.mako | 2 ++ src/generator/templates/api/lib/mbuild.mako | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/generator/templates/Cargo.toml.mako b/src/generator/templates/Cargo.toml.mako index 97e0c72b21..7885c43435 100644 --- a/src/generator/templates/Cargo.toml.mako +++ b/src/generator/templates/Cargo.toml.mako @@ -26,6 +26,8 @@ path = "src/main.rs" % endif [dependencies] +## TODO: temporary, remove when yup-oauth2 is optional +anyhow = "^ 1.0" hyper-rustls = "0.23.0" ## Must match the one hyper uses, otherwise there are duplicate similarly named `Mime` structs mime = "^ 0.2.0" diff --git a/src/generator/templates/api/lib/mbuild.mako b/src/generator/templates/api/lib/mbuild.mako index a3f5d4b5cc..7ba7c06a75 100644 --- a/src/generator/templates/api/lib/mbuild.mako +++ b/src/generator/templates/api/lib/mbuild.mako @@ -387,7 +387,7 @@ match result { Error::HttpError(_) |Error::Io(_) |Error::MissingAPIKey - |Error::MissingToken + |Error::MissingToken(_) |Error::Cancelled |Error::UploadSizeLimitExceeded(_, _) |Error::Failure(_) @@ -710,7 +710,7 @@ else { // TODO: remove Ok / Err branches Ok(Some(token)) => token.clone(), Ok(None) => { - let err = oauth2::OtherError("unknown error occurred while generating oauth2 token".into()); + let err = oauth2::Error::OtherError(anyhow::Error::msg("unknown error occurred while generating oauth2 token")); match dlg.token(&err) { Some(token) => token, None => {