mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
GitHub - add push error handler telemetry to understand usage (#185573)
* GitHub - add push error handler telemetry to understand usage * Add yarn.lock file * Pull request feedback
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import { TextDecoder } from 'util';
|
||||
import { commands, env, ProgressLocation, Uri, window, workspace, QuickPickOptions, FileType, l10n, Disposable, TextDocumentContentProvider } from 'vscode';
|
||||
import TelemetryReporter from '@vscode/extension-telemetry';
|
||||
import { getOctokit } from './auth';
|
||||
import { GitErrorCodes, PushErrorHandler, Remote, Repository } from './typings/git';
|
||||
import * as path from 'path';
|
||||
@@ -99,7 +100,7 @@ export class GithubPushErrorHandler implements PushErrorHandler {
|
||||
private disposables: Disposable[] = [];
|
||||
private commandErrors = new CommandErrorOutputTextDocumentContentProvider();
|
||||
|
||||
constructor() {
|
||||
constructor(private readonly telemetryReporter: TelemetryReporter) {
|
||||
this.disposables.push(workspace.registerTextDocumentContentProvider('github-output', this.commandErrors));
|
||||
}
|
||||
|
||||
@@ -126,15 +127,41 @@ export class GithubPushErrorHandler implements PushErrorHandler {
|
||||
|
||||
if (error.gitErrorCode === GitErrorCodes.PermissionDenied) {
|
||||
await this.handlePermissionDeniedError(repository, remote, refspec, owner, repo);
|
||||
|
||||
/* __GDPR__
|
||||
"pushErrorHandler" : {
|
||||
"owner": "lszomoru",
|
||||
"handler": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryReporter.sendTelemetryEvent('pushErrorHandler', { handler: 'PermissionDenied' });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Push protection
|
||||
if (/GH009: Secrets detected!/i.test(error.stderr)) {
|
||||
await this.handlePushProtectionError(owner, repo, error.stderr);
|
||||
|
||||
/* __GDPR__
|
||||
"pushErrorHandler" : {
|
||||
"owner": "lszomoru",
|
||||
"handler": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryReporter.sendTelemetryEvent('pushErrorHandler', { handler: 'PushRejected.PushProtection' });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* __GDPR__
|
||||
"pushErrorHandler" : {
|
||||
"owner": "lszomoru",
|
||||
"handler": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this.telemetryReporter.sendTelemetryEvent('pushErrorHandler', { handler: 'None' });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user