Skip to content

Commit 0da51e0

Browse files
committed
Adds extra logging
1 parent 6632bcd commit 0da51e0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/plus/gk/account/authenticationConnection.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ export class AuthenticationConnection implements Disposable {
6969
signUp: boolean = false,
7070
context?: TrackingContext,
7171
): Promise<string> {
72+
const scope = getLogScope();
73+
7274
this.updateStatusBarItem(true);
7375

7476
// Include a state parameter here to prevent CSRF attacks
@@ -88,6 +90,8 @@ export class AuthenticationConnection implements Disposable {
8890
);
8991

9092
if (!(await openUrl(uri.toString(true)))) {
93+
Logger.error(undefined, scope, 'Opening login URL failed');
94+
9195
this._pendingStates.delete(scopeKey);
9296
this.updateStatusBarItem(false);
9397
throw new Error('Cancelled');
@@ -103,11 +107,7 @@ export class AuthenticationConnection implements Disposable {
103107
this._deferredCodeExchanges.set(scopeKey, deferredCodeExchange);
104108
}
105109

106-
if (this._cancellationSource != null) {
107-
this._cancellationSource.cancel();
108-
this._cancellationSource = undefined;
109-
}
110-
110+
this._cancellationSource?.cancel();
111111
this._cancellationSource = new CancellationTokenSource();
112112

113113
try {
@@ -126,6 +126,9 @@ export class AuthenticationConnection implements Disposable {
126126

127127
const token = await this.getTokenFromCodeAndState(code, gkstate, scopeKey);
128128
return token;
129+
} catch (ex) {
130+
Logger.error(ex, scope);
131+
throw ex;
129132
} finally {
130133
this._cancellationSource?.cancel();
131134
this._cancellationSource = undefined;

0 commit comments

Comments
 (0)