github.com/eris-ltd/erisdb@v0.25.0/deploy/util/errors.go (about)

     1  package util
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/hyperledger/burrow/deploy/def"
     8  	"github.com/hyperledger/burrow/logging"
     9  )
    10  
    11  func Exit(err error) {
    12  	status := 0
    13  	if err != nil {
    14  		fmt.Fprintln(os.Stderr, err)
    15  		status = 1
    16  	}
    17  	os.Exit(status)
    18  }
    19  
    20  func ChainErrorHandler(account string, err error, logger *logging.Logger) error {
    21  	logger.InfoMsg("There has been an error talking to your Burrow chain",
    22  		"defAddr", account,
    23  		"rawErr", err)
    24  
    25  	return fmt.Errorf(`
    26  There has been an error talking to your Burrow chain using account %s.
    27  
    28  %v
    29  
    30  `, account, err)
    31  }
    32  
    33  func ABIErrorHandler(err error, call *def.Call, query *def.QueryContract, logger *logging.Logger) error {
    34  	switch {
    35  	case call != nil:
    36  		logger.InfoMsg("ABI Error",
    37  			"data", call.Data,
    38  			"bin", call.Bin,
    39  			"dest", call.Destination,
    40  			"rawErr", err)
    41  	case query != nil:
    42  		logger.InfoMsg("ABI Error",
    43  			"data", call.Data,
    44  			"bin", call.Bin,
    45  			"dest", call.Destination,
    46  			"rawErr", err)
    47  	}
    48  
    49  	return fmt.Errorf(`
    50  There has been an error in finding or in using your ABI. ABI's are "Application Binary
    51  Interface" and they are what let us know how to talk to smart contracts.
    52  
    53  These little json files can be read by a variety of things which need to talk to smart
    54  contracts so they are quite necessary to be able to find and use properly.
    55  
    56  The ABIs are saved after the deploy events. So if there was a glitch in the matrix,
    57  we apologize in advance.
    58  
    59  The marmot recovery checklist is...
    60    * ensure your chain is running and you have enough validators online
    61    * ensure that your contracts successfully deployed
    62    * if you used imports or have multiple contracts in one file check the instance
    63      variable in the deploy and the abi variable in the call/query-contract
    64    * make sure you're calling or querying the right function
    65    * make sure you're using the correct variables for job results
    66  `)
    67  }