Skip to content

Commit 901c288

Browse files
committed
Throw instead of rejecting promises to get better integration test
errors
1 parent b0cdacd commit 901c288

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/features/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ async function dotnetRestoreAllProjects(server: OmniSharpServer, eventStream: Ev
198198

199199
async function getProjectDescriptors(server: OmniSharpServer): Promise<protocol.ProjectDescriptor[]> {
200200
if (!server.isRunning()) {
201-
return Promise.reject('OmniSharp server is not running.');
201+
throw new Error('OmniSharp server is not running.');
202202
}
203203

204204
const info = await serverUtils.requestWorkspaceInformation(server);
205205
const descriptors = protocol.getDotNetCoreProjectDescriptors(info);
206206
if (descriptors.length === 0) {
207-
return Promise.reject('No .NET Core projects found');
207+
throw new Error('No .NET Core projects found');
208208
}
209209

210210
return descriptors;

src/omnisharp/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ export class OmniSharpServer {
741741

742742
public async makeRequest<TResponse>(command: string, data?: any, token?: CancellationToken): Promise<TResponse> {
743743
if (this._state.status !== ServerState.Started) {
744-
return Promise.reject<TResponse>('OmniSharp server is not running.');
744+
throw new Error('OmniSharp server is not running.');
745745
}
746746

747747
const { engine } = this._state;

0 commit comments

Comments
 (0)