@microsoft/vscode-azext-azureauth 6.0.0-alpha.3 → 6.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  })();
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.AzureSubscriptionProviderBase = void 0;
41
+ const util_1 = require("util");
41
42
  const vscode = __importStar(require("vscode"));
42
43
  const AzureSubscriptionProviderRequestOptions_1 = require("../contracts/AzureSubscriptionProviderRequestOptions");
43
44
  const configuredAzureEnv_1 = require("../utils/configuredAzureEnv");
@@ -165,7 +166,9 @@ class AzureSubscriptionProviderBase {
165
166
  this.logForTenant(tenant, 'Skipping account+tenant because it is not signed in');
166
167
  return;
167
168
  }
168
- throw err;
169
+ // Don't rethrow--skip tenants that fail for other reasons
170
+ // (e.g., locked account) so remaining tenants can still be listed
171
+ this.errorForTenant(tenant, 'Skipping account+tenant due to error', err);
169
172
  }
170
173
  }));
171
174
  }
@@ -175,6 +178,8 @@ class AzureSubscriptionProviderBase {
175
178
  this.logForAccount(account, 'Skipping account because it is not signed in');
176
179
  return;
177
180
  }
181
+ // Log and skip accounts that fail for other reasons (e.g., locked account)
182
+ this.errorForAccount(account, 'Skipping account due to error', err);
178
183
  }
179
184
  }));
180
185
  }
@@ -371,6 +376,30 @@ class AzureSubscriptionProviderBase {
371
376
  logForTenant(tenant, message) {
372
377
  this.logger?.debug(`[auth] [account: ${(0, screen_1.screen)(tenant.account)}] [tenant: ${(0, screen_1.screen)(tenant)}] ${message}`);
373
378
  }
379
+ warnForAccount(account, message) {
380
+ this.logger?.warn(`[auth] [account: ${(0, screen_1.screen)(account)}] ${message}`);
381
+ }
382
+ warnForTenant(tenant, message) {
383
+ this.logger?.warn(`[auth] [account: ${(0, screen_1.screen)(tenant.account)}] [tenant: ${(0, screen_1.screen)(tenant)}] ${message}`);
384
+ }
385
+ errorForAccount(account, message, err) {
386
+ this.logger?.error(`[auth] [account: ${(0, screen_1.screen)(account)}] ${message}`);
387
+ if (err instanceof Error) {
388
+ this.logger?.error(err);
389
+ }
390
+ else {
391
+ this.logger?.error(`[auth] [account: ${(0, screen_1.screen)(account)}] ${(0, util_1.inspect)(err)}`);
392
+ }
393
+ }
394
+ errorForTenant(tenant, message, err) {
395
+ this.logger?.error(`[auth] [account: ${(0, screen_1.screen)(tenant.account)}] [tenant: ${(0, screen_1.screen)(tenant)}] ${message}`);
396
+ if (err instanceof Error) {
397
+ this.logger?.error(err);
398
+ }
399
+ else {
400
+ this.logger?.error(`[auth] [account: ${(0, screen_1.screen)(tenant.account)}] [tenant: ${(0, screen_1.screen)(tenant)}] ${(0, util_1.inspect)(err)}`);
401
+ }
402
+ }
374
403
  throwIfCancelled(token) {
375
404
  if (token?.isCancellationRequested) {
376
405
  throw new vscode.CancellationError();
@@ -67,6 +67,10 @@ export declare abstract class AzureSubscriptionProviderBase implements AzureSubs
67
67
  protected log(message: string): void;
68
68
  protected logForAccount(account: AzureAccount, message: string): void;
69
69
  protected logForTenant(tenant: TenantIdAndAccount, message: string): void;
70
+ protected warnForAccount(account: AzureAccount, message: string): void;
71
+ protected warnForTenant(tenant: TenantIdAndAccount, message: string): void;
72
+ protected errorForAccount(account: AzureAccount, message: string, err: unknown): void;
73
+ protected errorForTenant(tenant: TenantIdAndAccount, message: string, err: unknown): void;
70
74
  protected throwIfCancelled(token: vscode.CancellationToken | undefined): void;
71
75
  private timeout;
72
76
  private silenceRefreshEvents;
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  *--------------------------------------------------------------------------------------------*/
5
+ import { inspect } from 'util';
5
6
  import * as vscode from 'vscode';
6
7
  import { DefaultOptions, DefaultSignInOptions } from '../contracts/AzureSubscriptionProviderRequestOptions';
7
8
  import { getConfiguredAuthProviderId, getConfiguredAzureEnv } from '../utils/configuredAzureEnv';
@@ -129,7 +130,9 @@ export class AzureSubscriptionProviderBase {
129
130
  this.logForTenant(tenant, 'Skipping account+tenant because it is not signed in');
130
131
  return;
131
132
  }
132
- throw err;
133
+ // Don't rethrow--skip tenants that fail for other reasons
134
+ // (e.g., locked account) so remaining tenants can still be listed
135
+ this.errorForTenant(tenant, 'Skipping account+tenant due to error', err);
133
136
  }
134
137
  }));
135
138
  }
@@ -139,6 +142,8 @@ export class AzureSubscriptionProviderBase {
139
142
  this.logForAccount(account, 'Skipping account because it is not signed in');
140
143
  return;
141
144
  }
145
+ // Log and skip accounts that fail for other reasons (e.g., locked account)
146
+ this.errorForAccount(account, 'Skipping account due to error', err);
142
147
  }
143
148
  }));
144
149
  }
@@ -335,6 +340,30 @@ export class AzureSubscriptionProviderBase {
335
340
  logForTenant(tenant, message) {
336
341
  this.logger?.debug(`[auth] [account: ${screen(tenant.account)}] [tenant: ${screen(tenant)}] ${message}`);
337
342
  }
343
+ warnForAccount(account, message) {
344
+ this.logger?.warn(`[auth] [account: ${screen(account)}] ${message}`);
345
+ }
346
+ warnForTenant(tenant, message) {
347
+ this.logger?.warn(`[auth] [account: ${screen(tenant.account)}] [tenant: ${screen(tenant)}] ${message}`);
348
+ }
349
+ errorForAccount(account, message, err) {
350
+ this.logger?.error(`[auth] [account: ${screen(account)}] ${message}`);
351
+ if (err instanceof Error) {
352
+ this.logger?.error(err);
353
+ }
354
+ else {
355
+ this.logger?.error(`[auth] [account: ${screen(account)}] ${inspect(err)}`);
356
+ }
357
+ }
358
+ errorForTenant(tenant, message, err) {
359
+ this.logger?.error(`[auth] [account: ${screen(tenant.account)}] [tenant: ${screen(tenant)}] ${message}`);
360
+ if (err instanceof Error) {
361
+ this.logger?.error(err);
362
+ }
363
+ else {
364
+ this.logger?.error(`[auth] [account: ${screen(tenant.account)}] [tenant: ${screen(tenant)}] ${inspect(err)}`);
365
+ }
366
+ }
338
367
  throwIfCancelled(token) {
339
368
  if (token?.isCancellationRequested) {
340
369
  throw new vscode.CancellationError();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@microsoft/vscode-azext-azureauth",
3
3
  "author": "Microsoft Corporation",
4
- "version": "6.0.0-alpha.3",
4
+ "version": "6.0.0-alpha.4",
5
5
  "description": "Azure authentication helpers for Visual Studio Code",
6
6
  "tags": [
7
7
  "azure",