@@ -69,6 +69,8 @@ export class AuthenticationConnection implements Disposable {
69
69
signUp : boolean = false ,
70
70
context ?: TrackingContext ,
71
71
) : Promise < string > {
72
+ const scope = getLogScope ( ) ;
73
+
72
74
this . updateStatusBarItem ( true ) ;
73
75
74
76
// Include a state parameter here to prevent CSRF attacks
@@ -88,6 +90,8 @@ export class AuthenticationConnection implements Disposable {
88
90
) ;
89
91
90
92
if ( ! ( await openUrl ( uri . toString ( true ) ) ) ) {
93
+ Logger . error ( undefined , scope , 'Opening login URL failed' ) ;
94
+
91
95
this . _pendingStates . delete ( scopeKey ) ;
92
96
this . updateStatusBarItem ( false ) ;
93
97
throw new Error ( 'Cancelled' ) ;
@@ -103,11 +107,7 @@ export class AuthenticationConnection implements Disposable {
103
107
this . _deferredCodeExchanges . set ( scopeKey , deferredCodeExchange ) ;
104
108
}
105
109
106
- if ( this . _cancellationSource != null ) {
107
- this . _cancellationSource . cancel ( ) ;
108
- this . _cancellationSource = undefined ;
109
- }
110
-
110
+ this . _cancellationSource ?. cancel ( ) ;
111
111
this . _cancellationSource = new CancellationTokenSource ( ) ;
112
112
113
113
try {
@@ -126,6 +126,9 @@ export class AuthenticationConnection implements Disposable {
126
126
127
127
const token = await this . getTokenFromCodeAndState ( code , gkstate , scopeKey ) ;
128
128
return token ;
129
+ } catch ( ex ) {
130
+ Logger . error ( ex , scope ) ;
131
+ throw ex ;
129
132
} finally {
130
133
this . _cancellationSource ?. cancel ( ) ;
131
134
this . _cancellationSource = undefined ;
0 commit comments