Skip to content

Commit

Permalink
Set more errors we throw to be excluded from telemetry (fix #187452) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Jul 24, 2023
1 parent 5cec5c6 commit 642ff50
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/vs/workbench/api/browser/mainThreadDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Emitter } from 'vs/base/common/event';
import { IPathService } from 'vs/workbench/services/path/common/pathService';
import { ResourceMap } from 'vs/base/common/map';
import { IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { ErrorNoTelemetry } from 'vs/base/common/errors';

export class BoundModelReferenceCollection {

Expand Down Expand Up @@ -212,7 +213,7 @@ export class MainThreadDocuments extends Disposable implements MainThreadDocumen
async $tryOpenDocument(uriData: UriComponents): Promise<URI> {
const inputUri = URI.revive(uriData);
if (!inputUri.scheme || !(inputUri.fsPath || inputUri.authority)) {
throw new Error(`Invalid uri. Scheme and authority or path must be set.`);
throw new ErrorNoTelemetry(`Invalid uri. Scheme and authority or path must be set.`);
}

const canonicalUri = this._uriIdentityService.asCanonicalUri(inputUri);
Expand All @@ -232,14 +233,14 @@ export class MainThreadDocuments extends Disposable implements MainThreadDocumen
try {
documentUri = await promise;
} catch (err) {
throw new Error(`cannot open ${canonicalUri.toString()}. Detail: ${toErrorMessage(err)}`);
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}. Detail: ${toErrorMessage(err)}`);
}
if (!documentUri) {
throw new Error(`cannot open ${canonicalUri.toString()}`);
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}`);
} else if (!extUri.isEqual(documentUri, canonicalUri)) {
throw new Error(`cannot open ${canonicalUri.toString()}. Detail: Actual document opened as ${documentUri.toString()}`);
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}. Detail: Actual document opened as ${documentUri.toString()}`);
} else if (!this._modelTrackers.has(canonicalUri)) {
throw new Error(`cannot open ${canonicalUri.toString()}. Detail: Files above 50MB cannot be synchronized with extensions.`);
throw new ErrorNoTelemetry(`cannot open ${canonicalUri.toString()}. Detail: Files above 50MB cannot be synchronized with extensions.`);
} else {
return canonicalUri;
}
Expand Down

0 comments on commit 642ff50

Please sign in to comment.