<p>The Fabric model for transacting follows 'endorse' (or, execute), 'order', 'commit'.  A proposal is sent for endorsement at one or more peers, if the endorsements are successful, the client assembles the proposal and endorsements into a transaction which is submitted to ordering.  Once the transaction is ordered, the peers receive it in a block and perform validation (ensuring that the correct endorsements are present) and version control checks (ensuring that all of the inputs to execution are unmodified).  For a detailed architectural review see <a href="https://arxiv.org/abs/1801.10228v2" rel="nofollow noreferrer">this paper</a>.</p>
<p>Event listeners are for 'commit events', which are emitted in that last stage where the peer checks to see if the transaction is valid/consistent.  If the initial endorsement fails, then the client never submits the transaction to ordering, and therefore, no commit event occurs.</p>
<p>You may be confusing &quot;endorsement failure&quot; with &quot;endorsement policy failure&quot;.  An endorsement policy failure occurs when the client does not seek enough endorsements, or endorsements from the right peers, but submits the transaction anyway.  You will see an event with a failure in this case, but there was no error at endorsement time.</p>
Fabric event listener unable to capture endorsement failure scenario
<p>I have coded below logic to use fabric network event listener which will listen to transaction commit. However, it is working fine when transaction endorsed successfully but not when transaction endorsed unsuccessfully. Kindly let me know if I am missing something.</p>
<p><strong>Code snapshot:</strong></p>
<pre><code>const transaction = networkObj.contract.createTransaction('addOrg');

const tx_id = transaction.getTransactionID().getTransactionID();


await transaction.addCommitListener((err: any, txId: any, status: any, blockHeight: any) =&gt; {

  console.log('inside listener');

  if (err) {
    console.log(err)
    return
  }

  if (status === 'VALID') { 
    console.log('transaction committed');
    console.log('txId: ',txId,'status: ',status,'blockHeight: ',blockHeight);
    console.log('transaction committed end');
  } else {
    console.log('err transaction failed');
    console.log(status);
  }
});

transaction.submit(OrgAdd.organization, OrgAdd.orgShortName, OrgAdd.orgType, OrgAdd.industryType)

let responseMessage: ResponseMessage = new ResponseMessage({ message: tx_id });

console.log('before return');

return responseMessage;
</code></pre>
<p>Logs when transaction is endorsed successfully vs unsuccessfully.</p>
<p>Successful:</p>
<pre><code>Connected to mychannel. 
Connected to contract.  p2pmembers
Done connecting to network.
OrgAdd:  {
  organization: 'Manufacturer 10',
  orgShortName: 'MF10',
  orgType: 'manufacturer',
  industryType: 'Electronics'
}
before return
inside listener
transaction committed
&lt;&lt;txId:&gt;&gt;  7b1767397a9821e0e2e0b16c7f7ad4ada9d15a8a7b838c5cc542be50e260d497 &lt;&lt;status:&gt;&gt;  VALID &lt;&lt;blockHeight:&gt;&gt;  116
transaction committed end
</code></pre>
<p>Unsuccessful</p>
<pre><code>Connected to mychannel. 
Connected to contract.  p2pmembers
Done connecting to network.
OrgAdd:  {
  organization: 'Manufacturer 10',
  orgShortName: 'MF10',
  orgType: 'manufacturer',
  industryType: 'Electronics'
}
before return
2020-06-22T11:32:13.973Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member &gt;&gt; G0:0 - endorsement failed - Error: transaction returned with failure: Error: MF10 organization does exist
2020-06-22T11:32:13.975Z - error: [DiscoveryEndorsementHandler]: _endorse - endorsement failed::Error: Endorsement has failed 
</code></pre>