From 405bfeddac75cccd70808e6e6bcefacfdce5e93d Mon Sep 17 00:00:00 2001 From: Phi Date: Thu, 1 Sep 2022 16:30:36 +0200 Subject: [PATCH 1/2] Better ledger rejection error Print a more understandable error message when a transaction is being rejected on ledger. --- cli/send.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/send.go b/cli/send.go index a5200d3b8..9a8ebc25e 100644 --- a/cli/send.go +++ b/cli/send.go @@ -3,6 +3,7 @@ package cli import ( "encoding/hex" "fmt" + "strings" "github.com/urfave/cli/v2" "golang.org/x/xerrors" @@ -152,7 +153,11 @@ var sendCmd = &cli.Command{ sm, err := InteractiveSend(ctx, cctx, srv, proto) if err != nil { - return err + if strings.Contains(err.Error(), "no current EF") { + return xerrors.Errorf("transaction rejected on ledger: %w", err) + } else { + return err + } } fmt.Fprintf(cctx.App.Writer, "%s\n", sm.Cid()) From a5ea5ba9c1186266eb38dd73b72f88e81bf557f3 Mon Sep 17 00:00:00 2001 From: Phi Date: Thu, 1 Sep 2022 17:01:03 +0200 Subject: [PATCH 2/2] Fix lint Fix lint --- cli/send.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cli/send.go b/cli/send.go index 9a8ebc25e..b5bfd3eb0 100644 --- a/cli/send.go +++ b/cli/send.go @@ -155,9 +155,8 @@ var sendCmd = &cli.Command{ if err != nil { if strings.Contains(err.Error(), "no current EF") { return xerrors.Errorf("transaction rejected on ledger: %w", err) - } else { - return err } + return err } fmt.Fprintf(cctx.App.Writer, "%s\n", sm.Cid())