Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 84d0718

Browse files
committed
FABN-900 NodeSDK Connect error return URL
Have the connect by deadline error message include the URL address of the remote endpoint. Change-Id: I0a3f877f87af237d7d0e60010fb9ccd77d74f9e7 Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
1 parent 8a56714 commit 84d0718

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

fabric-client/lib/Remote.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class Remote {
128128
}
129129

130130
waitForReady(client) {
131+
const self = this;
131132
if (!client) {
132133
throw new Error('Missing required gRPC client');
133134
}
@@ -136,6 +137,9 @@ class Remote {
136137
return new Promise((resolve, reject) => {
137138
client.waitForReady(timeout, (err) => {
138139
if (err) {
140+
if(err.message) {
141+
err.message = err.message + ' URL:'+ self.getUrl();
142+
}
139143
logger.error(err);
140144

141145
return reject(err);

test/unit/remote.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const aHost = 'atesthostname:9999';
3838
const url = 'grpcs://' + aHost;
3939
const aHostnameOverride = 'atesthostnameoverride';
4040

41-
test('\n\n ** Remote node tests **\n\n', function (t) {
41+
test('\n\n ** Remote node tests **\n\n', async function (t) {
4242
testutil.resetDefaults();
4343

4444
t.comment('\n * REMOTE *');
@@ -142,6 +142,17 @@ test('\n\n ** Remote node tests **\n\n', function (t) {
142142
'Check not passing any GRPC options.'
143143
);
144144

145+
peer = new Peer(url, {pem: aPem, clientKey: aPem, clientCert: aPem});
146+
try {
147+
await peer.sendProposal({}, 100);
148+
} catch(error) {
149+
if(error.toString().includes(peer.getUrl())) {
150+
t.pass('Successfully got the waitForReady URL address error');
151+
} else {
152+
t.fail('Failed to get the waitForReady URL address error');
153+
}
154+
}
155+
145156
opts = { pem: aPem, 'ssl-target-name-override': aHostnameOverride };
146157
peer = new Peer(url, opts);
147158
t.equal(aHost, peer._endpoint.addr, 'GRPC Options tests: new Peer grpcs with opts created');

0 commit comments

Comments
 (0)