From ed1856deb511df553ec419397be3e774f1265cf1 Mon Sep 17 00:00:00 2001 From: Alexandre Bourget Date: Wed, 28 Nov 2018 10:39:52 -0500 Subject: [PATCH] Display error messages more properly. Removed MAMA --- eosc/cmd/common.go | 14 ++++++++++++-- eosc/cmd/msigPropose.go | 2 -- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/eosc/cmd/common.go b/eosc/cmd/common.go index f7dbd6cf..ecd5694c 100644 --- a/eosc/cmd/common.go +++ b/eosc/cmd/common.go @@ -224,9 +224,13 @@ func optionallyPushTransaction(signedTx *eos.SignedTransaction, packedTx *eos.Pa func pushTransaction(api *eos.API, packedTx *eos.PackedTransaction, chainID eos.SHA256Bytes) { resp, err := api.PushTransaction(packedTx) - errorCheck("pushing transaction", err) + if err != nil { + if typedErr, ok := err.(eos.APIError); ok { + printError(typedErr) + } + errorCheck("pushing transaction", err) + } - //fmt.Println("Transaction submitted to the network. Confirm at https://eosq.app/tx/" + resp.TransactionID) trxURL := transactionURL(chainID, resp.TransactionID) fmt.Printf("\nTransaction submitted to the network.\n %s\n", trxURL) if resp.BlockID != "" { @@ -257,6 +261,12 @@ func blockURL(chainID eos.SHA256Bytes, blockID string) string { return blockID } +func printError(err eos.APIError) { + enc := json.NewEncoder(os.Stdout) + enc.SetIndent("", " ") + enc.Encode(err) +} + func yamlUnmarshal(cnt []byte, v interface{}) error { jsonCnt, err := yaml2json.Convert(cnt) if err != nil { diff --git a/eosc/cmd/msigPropose.go b/eosc/cmd/msigPropose.go index 6b4b582f..e8bd9642 100644 --- a/eosc/cmd/msigPropose.go +++ b/eosc/cmd/msigPropose.go @@ -71,8 +71,6 @@ Pass --requested-permissions return el1.Permission < el2.Permission }) - fmt.Println("MAMA", requested) - pushEOSCActions(api, msig.NewPropose(proposer, proposalName, requested, tx), )