Skip to content

Commit

Permalink
fix: don't report InternalError on tsserver error response (#709)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Mar 27, 2023
1 parent 70eae7e commit 3e63165
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tsp-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

import { URI } from 'vscode-uri';
import { ResponseError } from 'vscode-languageserver';
import type lsp from 'vscode-languageserver';
import type { CancellationToken } from 'vscode-jsonrpc';
import { Logger, PrefixingLogger } from './utils/logger.js';
Expand Down Expand Up @@ -302,13 +303,17 @@ export class TspClient {
return this.executeAsync(CommandTypes.Geterr, args, token);
}

public request<K extends keyof StandardTsServerRequests>(
public async request<K extends keyof StandardTsServerRequests>(
command: K,
args: StandardTsServerRequests[K][0],
token?: CancellationToken,
config?: ExecConfig,
): Promise<ServerResponse.Response<StandardTsServerRequests[K][1]>> {
return this.execute(command, args, token, config);
try {
return await this.execute(command, args, token, config);
} catch (error) {
throw new ResponseError(1, (error as Error).message);
}
}

// Low-level API.
Expand Down

0 comments on commit 3e63165

Please sign in to comment.