Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to error masking #4264

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/createFunctionApp/FunctionAppCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { type NameValuePair, type Site, type SiteConfig, type WebSiteManagementC
import { BlobServiceClient } from '@azure/storage-blob';
import { ParsedSite, WebsiteOS, type CustomLocation, type IAppServiceWizardContext } from '@microsoft/vscode-azext-azureappservice';
import { LocationListStep } from '@microsoft/vscode-azext-azureutils';
import { AzureWizardExecuteStep, parseError, randomUtils } from '@microsoft/vscode-azext-utils';
import { AzureWizardExecuteStep, maskUserInfo, parseError, randomUtils } from '@microsoft/vscode-azext-utils';
import { type AppResource } from '@microsoft/vscode-azext-utils/hostapi';
import { type Progress } from 'vscode';
import { FuncVersion, getMajorVersion } from '../../FuncVersion';
Expand Down Expand Up @@ -53,7 +53,7 @@ export class FunctionAppCreateStep extends AzureWizardExecuteStep<IFunctionAppWi
await enableFileLogging(context, site);
} catch (error) {
// optional part of creating function app, so not worth blocking on error
context.telemetry.properties.fileLoggingError = parseError(error).message;
context.telemetry.properties.fileLoggingError = maskUserInfo(parseError(error).message, []);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/commands/createFunctionApp/stacks/getStackPicks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { type ServiceClient } from '@azure/core-client';
import { createPipelineRequest } from '@azure/core-rest-pipeline';
import { createGenericClient, LocationListStep, type AzExtPipelineResponse } from '@microsoft/vscode-azext-azureutils';
import { openUrl, parseError, type AgentQuickPickItem, type IAzureQuickPickItem } from '@microsoft/vscode-azext-utils';
import { maskUserInfo, openUrl, parseError, type AgentQuickPickItem, type IAzureQuickPickItem } from '@microsoft/vscode-azext-utils';
import { funcVersionLink } from '../../../FuncVersion';
import { hiddenStacksSetting, noRuntimeStacksAvailableLabel } from '../../../constants';
import { previewDescription } from '../../../constants-nls';
Expand Down Expand Up @@ -166,7 +166,7 @@ async function getStacks(context: IFunctionAppWizardContext & { _stacks?: Functi
// Some environments (like Azure Germany/Mooncake) don't support the stacks ARM API yet
// And since the stacks don't change _that_ often, we'll just use a backup hard-coded value
stacksArmResponse = <StacksArmResponse>JSON.parse(backupStacks);
context.telemetry.properties.getStacksError = parseError(error).message;
context.telemetry.properties.getStacksError = maskUserInfo(parseError(error).message, []);
}

context._stacks = stacksArmResponse.value.map(d => d.properties);
Expand Down
4 changes: 2 additions & 2 deletions src/debug/validatePreDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { BlobServiceClient } from '@azure/storage-blob';
import { AzExtFsExtra, parseError, type IActionContext } from "@microsoft/vscode-azext-utils";
import { AzExtFsExtra, maskUserInfo, parseError, type IActionContext } from "@microsoft/vscode-azext-utils";
import * as path from 'path';
import * as semver from 'semver';
import * as vscode from 'vscode';
Expand Down Expand Up @@ -90,7 +90,7 @@ export async function preDebugValidate(actionContext: IActionContext, debugConfi
} else {
// Don't block debugging for "unexpected" errors. The func cli might still work
shouldContinue = true;
context.telemetry.properties.preDebugValidateError = pe.message;
context.telemetry.properties.preDebugValidateError = maskUserInfo(pe.message, []);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/funcCoreTools/validateFuncCoreToolsIsLatest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { callWithTelemetryAndErrorHandling, DialogResponses, parseError, type IActionContext } from '@microsoft/vscode-azext-utils';
import { callWithTelemetryAndErrorHandling, DialogResponses, maskUserInfo, parseError, type IActionContext } from '@microsoft/vscode-azext-utils';
import * as semver from 'semver';
import type * as vscode from 'vscode';
import { PackageManager } from '../constants';
Expand Down Expand Up @@ -120,7 +120,7 @@ async function getNewestFunctionRuntimeVersion(packageManager: PackageManager |
return (await getNpmDistTag(context, versionFromSetting)).value;
}
} catch (error) {
context.telemetry.properties.latestRuntimeError = parseError(error).message;
context.telemetry.properties.latestRuntimeError = maskUserInfo(parseError(error).message, []);
}

return undefined;
Expand Down
8 changes: 4 additions & 4 deletions src/templates/CentralTemplateProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { parseError, type IActionContext } from '@microsoft/vscode-azext-utils';
import { maskUserInfo, parseError, type IActionContext } from '@microsoft/vscode-azext-utils';
import { Disposable, workspace, type ConfigurationChangeEvent } from 'vscode';
import { FuncVersion } from '../FuncVersion';
import { ProjectLanguage, TemplateFilter, projectTemplateKeySetting } from '../constants';
Expand Down Expand Up @@ -237,7 +237,7 @@ export class CentralTemplateProvider implements Disposable {
// This error should be the most actionable to the user, so save it and throw later if cache/backup doesn't work
latestErrorMessage = localize('latestTemplatesError', 'Failed to get latest templates: {0}', errorMessage);
ext.outputChannel.appendLog(latestErrorMessage);
context.telemetry.properties.latestTemplatesError = errorMessage;
context.telemetry.properties.latestTemplatesError = maskUserInfo(errorMessage, []);
}

// 3. Use the cached templates, even if they don't match latestTemplateVersion
Expand Down Expand Up @@ -293,7 +293,7 @@ export class CentralTemplateProvider implements Disposable {
} catch (error) {
const errorMessage: string = parseError(error).message;
ext.outputChannel.appendLog(localize('cachedTemplatesError', 'Failed to get cached templates: {0}', errorMessage));
context.telemetry.properties.cachedTemplatesError = errorMessage;
context.telemetry.properties.cachedTemplatesError = maskUserInfo(errorMessage, []);
}
}

Expand All @@ -313,7 +313,7 @@ export class CentralTemplateProvider implements Disposable {
} catch (error) {
const errorMessage: string = parseError(error).message;
ext.outputChannel.appendLog(localize('backupTemplatesError', 'Failed to get backup templates: {0}', errorMessage));
context.telemetry.properties.backupTemplatesError = errorMessage;
context.telemetry.properties.backupTemplatesError = maskUserInfo(errorMessage, []);
}
}

Expand Down
Loading