File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ use crate::auth::{
5656 AuthError ,
5757 START_URL ,
5858} ;
59+ use crate :: aws_common:: SdkErrorDisplay ;
60+ use aws_smithy_runtime_api:: client:: result:: SdkError ;
5961use crate :: database:: Database ;
6062
6163const DEFAULT_AUTHORIZATION_TIMEOUT : Duration = Duration :: from_secs ( 60 * 3 ) ;
@@ -139,7 +141,10 @@ impl PkceClient for Client {
139141 for scope in Self :: scopes ( ) {
140142 register = register. scopes ( scope) ;
141143 }
142- let output = register. send ( ) . await ?;
144+ let output = register. send ( ) . await . map_err ( |e| match e {
145+ SdkError :: DispatchFailure ( _) => AuthError :: OAuthCustomError ( format ! ( "Authentication failed: {}" , SdkErrorDisplay ( & e) ) ) ,
146+ other => other. into ( )
147+ } ) ?;
143148 Ok ( RegisterClientResponse { output } )
144149 }
145150
@@ -153,7 +158,11 @@ impl PkceClient for Client {
153158 . code_verifier ( args. code_verifier )
154159 . code ( args. code )
155160 . send ( )
156- . await ?;
161+ . await
162+ . map_err ( |e| match e {
163+ SdkError :: DispatchFailure ( _) => AuthError :: OAuthCustomError ( format ! ( "Authentication failed: {}" , SdkErrorDisplay ( & e) ) ) ,
164+ other => other. into ( )
165+ } ) ?;
157166 Ok ( CreateTokenResponse { output } )
158167 }
159168}
You can’t perform that action at this time.
0 commit comments