Clean up extension telemetry (#5596)

This commit is contained in:
Charles Gagnon
2019-05-23 15:29:28 -07:00
committed by GitHub
parent 776e2cf6e7
commit fbbf767700
3 changed files with 53 additions and 32 deletions

View File

@@ -36,4 +36,26 @@ export function doubleEscapeSingleQuotes(value: string): string {
*/
export function backEscapeDoubleQuotes(value: string): string {
return value.replace(/"/g, '\\"');
}
/**
* Map an error message into a GDPR-Compliant short name for the type of error.
* @param msg The error message to map
*/
export function getTelemetryErrorType(msg: string): string {
if (msg.indexOf('is not recognized as an internal or external command') !== -1) {
return 'ExeNotFound';
}
else if (msg.indexOf('Unknown Action') !== -1) {
return 'UnknownAction';
}
else if (msg.indexOf('No Action Provided') !== -1) {
return 'NoActionProvided';
}
else if (msg.indexOf('Run exception') !== -1) {
return 'RunException';
}
else {
return 'Other';
}
}