Skip to content

Commit

Permalink
Have FileSystemError adopt ErrorNoTelemetry (#155885)
Browse files Browse the repository at this point in the history
* Cleanup FileSystemErrors

* Implement the naive solution

* hm?

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
  • Loading branch information
lramos15 and bpasero committed Aug 16, 2022
1 parent 2c93c17 commit f152032
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/vs/base/common/errors.ts
Expand Up @@ -243,7 +243,7 @@ export class ErrorNoTelemetry extends Error {

constructor(msg?: string) {
super(msg);
this.name = 'ErrorNoTelemetry';
this.name = 'CodeExpectedError';
}

public static fromError(err: Error): ErrorNoTelemetry {
Expand All @@ -258,7 +258,7 @@ export class ErrorNoTelemetry extends Error {
}

public static isErrorNoTelemetry(err: Error): err is ErrorNoTelemetry {
return err.name === 'ErrorNoTelemetry';
return err.name === 'CodeExpectedError';
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/vs/platform/telemetry/common/errorTelemetry.ts
Expand Up @@ -7,6 +7,7 @@ import { binarySearch } from 'vs/base/common/arrays';
import { errorHandler, ErrorNoTelemetry } from 'vs/base/common/errors';
import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
import { safeStringify } from 'vs/base/common/objects';
import { FileOperationError } from 'vs/platform/files/common/files';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';

type ErrorEventFragment = {
Expand Down Expand Up @@ -87,7 +88,8 @@ export default abstract class BaseErrorTelemetry {
}

// If it's the no telemetry error it doesn't get logged
if (ErrorNoTelemetry.isErrorNoTelemetry(err)) {
// TOOD @lramos15 hacking in FileOperation error because it's too messy to adopt ErrorNoTelemetry. A better solution should be found
if (ErrorNoTelemetry.isErrorNoTelemetry(err) || err instanceof FileOperationError) {
return;
}

Expand Down

0 comments on commit f152032

Please sign in to comment.