[#1386] frostfs-adm: Add info to error messages
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 50s
DCO action / DCO (pull_request) Successful in 1m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m54s
Vulncheck / Vulncheck (pull_request) Successful in 1m52s
Build / Build Components (pull_request) Successful in 2m15s
Tests and linters / gopls check (pull_request) Successful in 2m23s
Tests and linters / Staticcheck (pull_request) Successful in 2m47s
Tests and linters / Tests (pull_request) Successful in 4m0s
Tests and linters / Tests with -race (pull_request) Successful in 5m18s
Tests and linters / Lint (pull_request) Successful in 2m39s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 50s
DCO action / DCO (pull_request) Successful in 1m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m54s
Vulncheck / Vulncheck (pull_request) Successful in 1m52s
Build / Build Components (pull_request) Successful in 2m15s
Tests and linters / gopls check (pull_request) Successful in 2m23s
Tests and linters / Staticcheck (pull_request) Successful in 2m47s
Tests and linters / Tests (pull_request) Successful in 4m0s
Tests and linters / Tests with -race (pull_request) Successful in 5m18s
Tests and linters / Lint (pull_request) Successful in 2m39s
These error messages bubble up to human users - adding more context helps to find the cause of the issue faster. Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
parent
53a90634fc
commit
26b65a0141
2 changed files with 22 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
||||||
package initialize
|
package initialize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
|
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||||
|
@ -29,10 +31,14 @@ func setNotaryAndAlphabetNodes(c *helper.InitializeContext) error {
|
||||||
callflag.States|callflag.AllowNotify, int64(noderoles.NeoFSAlphabet), pubs)
|
callflag.States|callflag.AllowNotify, int64(noderoles.NeoFSAlphabet), pubs)
|
||||||
|
|
||||||
if err := c.SendCommitteeTx(w.Bytes(), false); err != nil {
|
if err := c.SendCommitteeTx(w.Bytes(), false); err != nil {
|
||||||
return err
|
return fmt.Errorf("committee transaction: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.AwaitTx()
|
err := c.AwaitTx()
|
||||||
|
if err != nil {
|
||||||
|
err = fmt.Errorf("committee transaction: %w", err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func setRolesFinished(c *helper.InitializeContext) (bool, error) {
|
func setRolesFinished(c *helper.InitializeContext) (bool, error) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package initialize
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper"
|
||||||
|
@ -144,5 +145,17 @@ func createNEP17MultiTransferTx(c helper.Client, acc *wallet.Account, recipients
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't create actor: %w", err)
|
return nil, fmt.Errorf("can't create actor: %w", err)
|
||||||
}
|
}
|
||||||
return act.MakeRun(w.Bytes())
|
tx, err := act.MakeRun(w.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
sum := make(map[util.Uint160]int64)
|
||||||
|
for _, recipient := range recipients {
|
||||||
|
sum[recipient.Token] += recipient.Amount
|
||||||
|
}
|
||||||
|
detail := make([]string, 0, len(sum))
|
||||||
|
for _, value := range sum {
|
||||||
|
detail = append(detail, fmt.Sprintf("amount=%v", value))
|
||||||
|
}
|
||||||
|
err = fmt.Errorf("transfer failed: from=%s(%s) %s: %w", acc.Label, acc.Address, strings.Join(detail, " "), err)
|
||||||
|
}
|
||||||
|
return tx, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue