@@ -362,8 +362,14 @@ private void sendUpdateChannel(byte[] configupdate, byte[][] signers, Orderer or
362362
363363 if (duration > CHANNEL_CONFIG_WAIT_TIME ) {
364364 //waited long enough .. throw an exception
365- throw new TransactionException (format ("Channel %s update error timed out after %d ms. Status value %d. Status %s" , name ,
366- duration , statusCode , trxResult .getStatus ().name ()));
365+ String info = trxResult .getInfo ();
366+ if (null == info ) {
367+ info = "" ;
368+
369+ }
370+
371+ throw new TransactionException (format ("Channel %s update error timed out after %d ms. Status value %d. Status %s. %s" , name ,
372+ duration , statusCode , trxResult .getStatus ().name (), info ));
367373 }
368374
369375 try {
@@ -375,8 +381,15 @@ private void sendUpdateChannel(byte[] configupdate, byte[][] signers, Orderer or
375381
376382 } else if (200 != statusCode ) {
377383 // Can't retry.
378- throw new TransactionException (format ("New channel %s error. StatusValue %d. Status %s" , name ,
379- statusCode , "" + trxResult .getStatus ()));
384+
385+ String info = trxResult .getInfo ();
386+ if (null == info ) {
387+ info = "" ;
388+
389+ }
390+
391+ throw new TransactionException (format ("New channel %s error. StatusValue %d. Status %s. %s" , name ,
392+ statusCode , "" + trxResult .getStatus (), info ));
380393 }
381394
382395 } while (200 != statusCode ); // try again
@@ -2378,7 +2391,6 @@ public CompletableFuture<TransactionEvent> sendTransaction(Collection<ProposalRe
23782391 if (null != diagnosticFileDumper ) {
23792392 logger .trace (format ("Sending to channel %s, orderer: %s, transaction: %s" , name , orderer .getName (),
23802393 diagnosticFileDumper .createDiagnosticProtobufFile (transactionEnvelope .toByteArray ())));
2381-
23822394 }
23832395
23842396 resp = orderer .sendTransaction (transactionEnvelope );
@@ -2391,7 +2403,26 @@ public CompletableFuture<TransactionEvent> sendTransaction(Collection<ProposalRe
23912403 } catch (Exception e ) {
23922404 String emsg = format ("Channel %s unsuccessful sendTransaction to orderer" , name );
23932405 if (resp != null ) {
2394- emsg = format ("Channel %s unsuccessful sendTransaction to orderer. Status %s" , name , resp .getStatus ());
2406+
2407+ StringBuilder respdata = new StringBuilder (400 );
2408+
2409+ Status status = resp .getStatus ();
2410+ if (null != status ) {
2411+ respdata .append (status .name ());
2412+ respdata .append ("-" );
2413+ respdata .append (status .getNumber ());
2414+ }
2415+
2416+ String info = resp .getInfo ();
2417+ if (null != info && !info .isEmpty ()) {
2418+ if (respdata .length () > 0 ) {
2419+ respdata .append (", " );
2420+ }
2421+
2422+ respdata .append ("Additional information: " ).append (info );
2423+
2424+ }
2425+ emsg = format ("Channel %s unsuccessful sendTransaction to orderer. %s" , name , respdata .toString ());
23952426 }
23962427
23972428 logger .error (emsg , e );
@@ -2404,7 +2435,28 @@ public CompletableFuture<TransactionEvent> sendTransaction(Collection<ProposalRe
24042435 logger .debug (format ("Channel %s successful sent to Orderer transaction id: %s" , name , proposalTransactionID ));
24052436 return sret ;
24062437 } else {
2407- String emsg = format ("Channel %s failed to place transaction %s on Orderer. Cause: UNSUCCESSFUL" , name , proposalTransactionID );
2438+ StringBuilder respdata = new StringBuilder (400 );
2439+ if (resp != null ) {
2440+ Status status = resp .getStatus ();
2441+ if (null != status ) {
2442+ respdata .append (status .name ());
2443+ respdata .append ("-" );
2444+ respdata .append (status .getNumber ());
2445+ }
2446+
2447+ String info = resp .getInfo ();
2448+ if (null != info && !info .isEmpty ()) {
2449+ if (respdata .length () > 0 ) {
2450+ respdata .append (", " );
2451+ }
2452+
2453+ respdata .append ("Additional information: " ).append (info );
2454+
2455+ }
2456+
2457+ }
2458+ String emsg = format ("Channel %s failed to place transaction %s on Orderer. Cause: UNSUCCESSFUL. %s" ,
2459+ name , proposalTransactionID , respdata .toString ());
24082460 CompletableFuture <TransactionEvent > ret = new CompletableFuture <>();
24092461 ret .completeExceptionally (new Exception (emsg ));
24102462 return ret ;
0 commit comments