Class RevertReasonExtractor


  • public class RevertReasonExtractor
    extends java.lang.Object
    Revert reason extraction and retrieval functions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String MISSING_REASON  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String extractRevertReason​(TransactionReceipt transactionReceipt, java.lang.String data, Web3j web3j, java.lang.Boolean revertReasonCallEnabled)
      Extracts the error reason of a reverted transaction (if one exists and enabled).
      static java.lang.String retrieveRevertReason​(TransactionReceipt transactionReceipt, java.lang.String data, Web3j web3j)
      Retrieves the error reason of a reverted transaction (if one exists).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RevertReasonExtractor

        public RevertReasonExtractor()
    • Method Detail

      • extractRevertReason

        public static java.lang.String extractRevertReason​(TransactionReceipt transactionReceipt,
                                                           java.lang.String data,
                                                           Web3j web3j,
                                                           java.lang.Boolean revertReasonCallEnabled)
                                                    throws java.io.IOException
        Extracts the error reason of a reverted transaction (if one exists and enabled).
        Parameters:
        transactionReceipt - the reverted transaction receipt
        data - the reverted transaction data
        web3j - Web3j instance
        revertReasonCallEnabled - flag of reason retrieval via additional call
        Returns:
        the reverted transaction error reason if exists or null otherwise
        Throws:
        java.io.IOException - if the call to the node fails
      • retrieveRevertReason

        public static java.lang.String retrieveRevertReason​(TransactionReceipt transactionReceipt,
                                                            java.lang.String data,
                                                            Web3j web3j)
                                                     throws java.io.IOException
        Retrieves the error reason of a reverted transaction (if one exists).
        Parameters:
        transactionReceipt - the reverted transaction receipt
        data - the reverted transaction data
        web3j - Web3j instance
        Returns:
        the reverted transaction error reason if exists or null otherwise
        Throws:
        java.io.IOException - if the call to the node fails