Skip to content

Commit

Permalink
Fix Fabric orderer error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Attila Klenik <[email protected]>
  • Loading branch information
aklenik committed Mar 2, 2020
1 parent f19275a commit 0a51d0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions packages/caliper-fabric/lib/adaptor-versions/v1/fabric-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -1826,10 +1826,13 @@ class Fabric extends BlockchainInterface {

broadcastResponse = await responsePromise;
} catch (err) {
// missing the ACK does not mean anything, the Tx could be already under ordering
// so let the events decide the final status, but log this error
// either an explicit deny from the orderer
// or a timeout occurred (eating up all the allocated time for the TX)
invokeStatus.Set(`broadcast_error_${targetOrderer}`, err.message);
logger.warn(`Broadcast error from ${targetOrderer}: ${err.message}`);
invokeStatus.SetVerification(true);

errors.push(new Error(`Broadcast error from ${targetOrderer}: ${err.message}`));
throw errors;
}

invokeStatus.Set('time_orderer_ack', Date.now());
Expand Down
9 changes: 6 additions & 3 deletions packages/caliper-fabric/lib/adaptor-versions/v2/fabric-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1826,10 +1826,13 @@ class Fabric extends BlockchainInterface {

broadcastResponse = await responsePromise;
} catch (err) {
// missing the ACK does not mean anything, the Tx could be already under ordering
// so let the events decide the final status, but log this error
// either an explicit deny from the orderer
// or a timeout occurred (eating up all the allocated time for the TX)
invokeStatus.Set(`broadcast_error_${targetOrderer}`, err.message);
logger.warn(`Broadcast error from ${targetOrderer}: ${err.message}`);
invokeStatus.SetVerification(true);

errors.push(new Error(`Broadcast error from ${targetOrderer}: ${err.message}`));
throw errors;
}

invokeStatus.Set('time_orderer_ack', Date.now());
Expand Down

0 comments on commit 0a51d0e

Please sign in to comment.