Skip to content

Commit

Permalink
FAB-8592 NodeSDK - return status info
Browse files Browse the repository at this point in the history
Orderer needs to return the status info on all
request not just on the 'SUCCESS'. NodeSDK will
not decide if the request is good or bad and return
to the application all data. Only receiving an GRPC
error will an error be returned.

Change-Id: I467dabe11ba36165224cb35d6e1d44eda841e2ab
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
  • Loading branch information
harrisob committed Mar 2, 2018
1 parent 3ddcfdf commit 15bc707
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
13 changes: 4 additions & 9 deletions fabric-client/lib/Orderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,12 @@ var Orderer = class extends Remote {
broadcast.on('data', function (response) {
logger.debug('sendBroadcast - on data response: %j', response);
broadcast.end();
if(response.info) {
if(response && response.info) {
logger.debug('sendBroadcast - response info :: %s', response.info);
}
if(response.status) {
if (response.status === 'SUCCESS') {
logger.debug('sendBroadcast - resolve with %s', response.status);
return resolve(response);
} else {
logger.error('sendBroadcast - reject with %s', response.status);
return reject(new Error(response.status));
}
if(response && response.status) {
logger.debug('sendBroadcast - response status %s', response.status);
return resolve(response);
}
else {
logger.error('sendBroadcast ERROR - reject with invalid response from the orderer');
Expand Down
26 changes: 18 additions & 8 deletions release_notes/v1.1.0-rc1.txt → release_notes/v1.1.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ v1.1.0 Febuary 22, 2018
Release Notes
-------------

FAB-8470
Users that have been using the 'grpc-max-send-message-length' configuration setting
may wish to use 'grpc.max_send_message_length' to avoid confusion with the actual
grpc settings.
Users that have been using the 'grpc-max-receive-message-length' configuration setting
may wish to use 'grpc.max_receive_message_length' to avoid confusion with the actual
grpc settings.

FAB-5398
Users trying to install globally the fabric-client or fabric-ca-client packages
may have issues. There are issues with a few dependent packages stopping the
Expand All @@ -20,6 +12,24 @@ able to be installed locally without issue. The only known solution to install
globally is to add the --unsafe-perm option.
sudo npm install -g fabric-client --unsafe-perm

FAB-8470
Users that have been using the 'grpc-max-send-message-length' configuration setting
may wish to use 'grpc.max_send_message_length' to avoid confusion with the actual
grpc settings.
Users that have been using the 'grpc-max-receive-message-length' configuration setting
may wish to use 'grpc.max_receive_message_length' to avoid confusion with the actual
grpc settings.

FAB-8592
Responses from submitting transactions to the orderer will now include an info field
to indicate any issues the orderer may have had with the submission along with the
the status field returned previously. All status states will now be returned in
the promise.resolve(response) rather than a error object in the promise.reject(error)
returned previously for states other than 'SUCCESS'. This allows the application
to evaluate the status and info of responses from the orderer and determine for
itself the results of the submission. Network and connection errors will continue
to be returned in the promise.reject(error) to indicate issues where the orderer
was unable to respond.

Known Vulnerabilities
---------------------
Expand Down
16 changes: 7 additions & 9 deletions test/integration/create-configtx-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,14 @@ test('\n\n***** Configtx Built config create flow *****\n\n', function(t) {
})
.then((result) => {
logger.debug(' response ::%j',result);
t.fail('Failed to get error. response: ' + result.status);
if(result && result.status && result.status.toString().indexOf('BAD_REQUEST') >= 0) {
t.pass('Successfully received the error message due to the conflict of channel: ' + result.info);
} else {
t.fail('Failed to get error. response: ' + result.status);
}
t.end();
}, (err) => {
if(err.toString().indexOf('BAD_REQUEST') >= 0) {
t.pass('Successfully received the error message due to the conflict of channel: ' + err);
t.end();
}
else {
t.fail('Got unexpected error: ' + err.stack ? err.stack : err);
t.end();
}
t.fail('Got unexpected error: ' + err.stack ? err.stack : err);
t.end();
});
});

0 comments on commit 15bc707

Please sign in to comment.