-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
The following implementation:
vscode-debugadapter-node/testSupport/src/protocolClient.ts
Lines 69 to 80 in 1621133
| public send(command: string, args?: any): Promise<DebugProtocol.Response> { | |
| return new Promise((completeDispatch, errorDispatch) => { | |
| this.doSend(command, args, (result: DebugProtocol.Response) => { | |
| if (result.success) { | |
| completeDispatch(result); | |
| } else { | |
| errorDispatch(new Error(result.message)); | |
| } | |
| }); | |
| }); | |
| } |
is not async itself and returns the promise immediately without awaiting it. Consequently, if the promise gets rejected with an error, the stack trace in the error does not include either
send or its caller. This unnecessarily complicates debugging of e.g. async unit tests that await send() and receive an unexpected error response.
Instead, the callback for doSend should capture the raw response in a wrapper promise, and then send should await that promise and translate it to a throw.
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug