Skip to content

Commit

Permalink
See redhat-developer/rsp-server-community#152 but for main extension
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
robstryker committed Jan 4, 2023
1 parent 7df20d1 commit bae5cc5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/extensionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ export class ExtensionAPI implements RSPController {
return serverInfo;
}).catch(error => {
this.updateRSPStateChanged(ServerState.STOPPED);
return Promise.reject(`RSP Error - ${RSP_PROVIDER_NAME} failed to start - ${error ? error : ''}`);
const innerMsg: string = error ? (error.message ? error.message : JSON.stringify(error)) : '';
return Promise.reject(`RSP Error - ${RSP_PROVIDER_NAME} failed to start - ${innerMsg}`);
});
}

public async stopRSP(): Promise<void> {
server.terminate().catch(error => {
return Promise.reject(`RSP Error - ${error ? error : ''}`);
const innerMsg: string = error ? (error.message ? error.message : JSON.stringify(error)) : '';
return Promise.reject(`RSP Error - ${RSP_PROVIDER_NAME} failed to stop - ${innerMsg}`);
});
}

Expand Down
5 changes: 4 additions & 1 deletion src/requirements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@ function rejectWithDownloadUrl(reject: {
}
reject({
message: message,
label: 'Get the Java Development Kit',
openUrl: Uri.parse(jdkUrl),
replaceClose: false,
btns: [
{
label: 'Get the Java Development Kit',
openUrl: Uri.parse(jdkUrl)
openUrl: Uri.parse(jdkUrl),
},
{
label: 'Configure Java'
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function start(stdoutCallback: (data: string) => void,
vscode.commands.executeCommand('vscode.open', btnSelected.openUrl);
} else {
vscode.window.showInformationMessage(
`To configure Java for Server Connector Extension addthe "rsp-ui.rsp.java.home" property to your settings file
`To configure Java for Server Connector Extension add the "rsp-ui.rsp.java.home" property to your settings file
(ex. "rsp-ui.rsp.java.home": "/usr/local/java/jdk1.8.0_45").`);
vscode.commands.executeCommand(
'workbench.action.openSettingsJson'
Expand Down
2 changes: 1 addition & 1 deletion test/extensionApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ suite('Extension API', () => {
await extensionApi.startRSP(stdCallback, stdCallback);
expect.fail('No error was thrown');
} catch (err) {
expect(err).equals('RSP Error - Red Hat Server Connector failed to start - Error: Error');
expect(err).equals('RSP Error - Red Hat Server Connector failed to start - Error');
}
});

Expand Down

0 comments on commit bae5cc5

Please sign in to comment.