Merge pull request #2574 from nspcc-dev/fix-message

smartcontract: print proper error message on failed testinvoke
This commit is contained in:
Roman Khimov 2022-07-04 14:14:24 +03:00 committed by GitHub
commit f0b08ba3e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -664,7 +664,11 @@ func invokeWithArgs(ctx *cli.Context, acc *wallet.Account, wall *wallet.Wallet,
return sender, cli.NewExitError(err, 1)
}
if resp.State != "HALT" {
errText := fmt.Sprintf("Warning: %s VM state returned from the RPC node: %s\n", resp.State, resp.FaultException)
errText := fmt.Sprintf("Warning: %s VM state returned from the RPC node: %s", resp.State, resp.FaultException)
if out == "" && !signAndPush {
return sender, cli.NewExitError(errText, 1)
}
action := "save"
process := "Saving"
if signAndPush {
@ -677,9 +681,9 @@ func invokeWithArgs(ctx *cli.Context, acc *wallet.Account, wall *wallet.Wallet,
}
}
if !ctx.Bool("force") {
return sender, cli.NewExitError(errText+". Use --force flag to "+action+" the transaction anyway.", 1)
return sender, cli.NewExitError(errText+".\nUse --force flag to "+action+" the transaction anyway.", 1)
}
fmt.Fprintln(ctx.App.Writer, errText+". "+process+" transaction...")
fmt.Fprintln(ctx.App.Writer, errText+".\n"+process+" transaction...")
}
if out != "" {
tx, err := c.CreateTxFromScript(resp.Script, acc, resp.GasConsumed+int64(sysgas), int64(gas), cosignersAccounts)