Skip to content

Commit

Permalink
debug: await handler's result
Browse files Browse the repository at this point in the history
A debug request handler can be implemented returning a Promise, which is
not awaited. This commit adds the missing `await` statement.

Signed-off-by: Paul Maréchal <paul.marechal@ericsson.com>
  • Loading branch information
paul-marechal committed Jun 30, 2020
1 parent e4d87c7 commit 09fb79f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/debug/src/browser/debug-session-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import { DebugProtocol } from 'vscode-debugprotocol';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { Event, Emitter, DisposableCollection, Disposable } from '@theia/core';
import { Event, Emitter, DisposableCollection, Disposable, MaybePromise } from '@theia/core';
import { OutputChannel } from '@theia/output/lib/common/output-channel';
import { IWebSocket } from 'vscode-ws-jsonrpc/lib/socket/socket';

Expand All @@ -27,7 +27,7 @@ export interface DebugExitEvent {
reason?: string | Error
}

export type DebugRequestHandler = (request: DebugProtocol.Request) => any;
export type DebugRequestHandler = (request: DebugProtocol.Request) => MaybePromise<any>;

export interface DebugRequestTypes {
'attach': [DebugProtocol.AttachRequestArguments, DebugProtocol.AttachResponse]
Expand Down Expand Up @@ -252,7 +252,7 @@ export class DebugSessionConnection implements Disposable {
const handler = this.requestHandlers.get(request.command);
if (handler) {
try {
response.body = handler(request);
response.body = await handler(request);
} catch (error) {
response.success = false;
response.message = error.message;
Expand Down

0 comments on commit 09fb79f

Please sign in to comment.