Skip to content

Commit bf15dfd

Browse files
authored
Merge pull request microsoft#78991 from amcasey/ShortenTelemetry
Strip a path list out of an error message
2 parents 9ee0333 + 41414c2 commit bf15dfd

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

extensions/typescript-language-features/src/tsServer/serverError.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ export class TypeScriptServerError extends Error {
4040
if (errorText) {
4141
const errorPrefix = 'Error processing request. ';
4242
if (errorText.startsWith(errorPrefix)) {
43-
const prefixFreeErrorText = errorText.substr(errorPrefix.length);
43+
let prefixFreeErrorText = errorText.substr(errorPrefix.length);
44+
45+
// Prior to https://github.com/microsoft/TypeScript/pull/32785, this error
46+
// returned and excessively long and detailed list of paths. Since server-side
47+
// filtering doesn't have sufficient granularity to drop these specific
48+
// messages, we sanitize them here.
49+
if (prefixFreeErrorText.indexOf('Could not find sourceFile') >= 0) {
50+
prefixFreeErrorText = prefixFreeErrorText.replace(/ in \[[^\]]*\]/g, '');
51+
}
52+
4453
const newlineIndex = prefixFreeErrorText.indexOf('\n');
4554
if (newlineIndex >= 0) {
4655
// Newline expected between message and stack.

0 commit comments

Comments
 (0)