Skip to content

Commit 3f93555

Browse files
committed
Add the runtime host and port address to exception message when failed to perform handshake
1 parent 98b1db6 commit 3f93555

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

Source/sdk/DolittleClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ export class DolittleClient extends IDolittleClient {
209209
const clients = this.createGrpcClients(configuration.runtimeHost, configuration.runtimePort);
210210

211211
const connector = new RuntimeConnector(
212+
configuration.runtimeHost,
213+
configuration.runtimePort,
212214
clients.handshake,
213215
clients.tenants,
214216
configuration.version,

Source/sdk/Internal/RuntimeConnector.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ export class RuntimeConnector extends ICanConnectToARuntime {
3434

3535
/**
3636
* Initialises a new instance of the {@link RuntimeConnector} class.
37+
* @param {string} _runtimeHost - The Dolittle Runtime host address.
38+
* @param {string} _runtimePort - The Dolittle Runtime address port.
3739
* @param {HandshakeClient} _handshakeClient - The client to use to perform the handshake.
3840
* @param {TenantsClient} _tenantsClient - The client to use for fetching the configured tenants.
3941
* @param {Version} _headVersion - The version of the head to use in the handshake.
4042
* @param {Logger} _logger - To use for logging.
4143
*/
4244
constructor(
45+
private readonly _runtimeHost: string,
46+
private readonly _runtimePort: number,
4347
private readonly _handshakeClient: HandshakeClient,
4448
private readonly _tenantsClient: TenantsClient,
4549
private readonly _headVersion: Version,
@@ -98,7 +102,7 @@ export class RuntimeConnector extends ICanConnectToARuntime {
98102
return (errors) => errors.pipe(
99103
map((error) => {
100104
if (isGrpcError(error) && error.code === GrpcStatus.UNIMPLEMENTED) {
101-
return Notification.createError<Error>(RuntimeVersionNotCompatible.unimplemented);
105+
return Notification.createError<Error>(RuntimeVersionNotCompatible.unimplemented(this._runtimeHost, this._runtimePort));
102106
} else if (error instanceof RuntimeVersionNotCompatible) {
103107
return Notification.createError<Error>(error);
104108
}

Source/sdk/RuntimeVersionNotCompatible.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@ import { VersionInfo } from './VersionInfo';
1010
export class RuntimeVersionNotCompatible extends Error {
1111
/**
1212
* Initialises a new instance of the {@link RuntimeVersionNotCompatible} class.
13+
* @param {string} runtimeHost - The Dolittle Runtime host address.
14+
* @param {string} runtimePort - The Dolittle Runtime address port.
1315
* @param {string} fix - The message that describes how to fix the issue.
1416
*/
15-
constructor(fix: string) {
16-
super(`This version of the SDK (${VersionInfo.currentVersion}) is not compatible with the Dolittle Runtime you are connecting to. ${fix}.`);
17+
constructor(runtimeHost: string, runtimePort: number, fix: string) {
18+
super(`This version of the SDK (${VersionInfo.currentVersion}) is not compatible with the Dolittle Runtime you are connecting to ${runtimeHost}:${runtimePort}. ${fix}.`);
1719
}
1820

1921
/**
2022
* The exception to throw when the Runtime returns an unimplemented exception during the handshake.
23+
* @param {string} runtimeHost - The Dolittle Runtime host address.
24+
* @param {string} runtimePort - The Dolittle Runtime address port.
25+
* @returns {RuntimeVersionNotCompatible} The {@link RuntimeVersionNotCompatible}.
2126
*/
22-
static get unimplemented(): RuntimeVersionNotCompatible {
23-
return new RuntimeVersionNotCompatible('Please upgrade the Runtime to version 7.4.0 or later');
27+
static unimplemented(runtimeHost: string, runtimePort: number): RuntimeVersionNotCompatible {
28+
return new RuntimeVersionNotCompatible(runtimeHost, runtimePort, 'Please upgrade the Runtime to version 7.4.0 or later');
2429
}
2530
}

0 commit comments

Comments
 (0)