Better ledger rejection error

Print a more understandable error message when a transaction is being rejected on ledger.
This commit is contained in:
Phi 2022-09-01 16:30:36 +02:00
parent 088bf56f2a
commit 405bfeddac

View File

@ -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())