[#647] pkg/morph: Add constant var to err message

Use defined constant variable instead of
hardcoded number in error message.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-06-25 14:16:03 +03:00 committed by Alex Vanin
parent 4075bed068
commit 403f836968

View file

@ -140,7 +140,11 @@ func peerInfoFromStackItem(prm stackitem.Item) ([]byte, error) {
if err != nil { if err != nil {
return nil, fmt.Errorf("could not get stack item array (PeerInfo): %w", err) return nil, fmt.Errorf("could not get stack item array (PeerInfo): %w", err)
} else if ln := len(prms); ln != nodeInfoFixedPrmNumber { } else if ln := len(prms); ln != nodeInfoFixedPrmNumber {
return nil, fmt.Errorf("unexpected stack item count (PeerInfo): expected %d, has %d", 1, ln) return nil, fmt.Errorf(
"unexpected stack item count (PeerInfo): expected %d, has %d",
nodeInfoFixedPrmNumber,
ln,
)
} }
return client.BytesFromStackItem(prms[0]) return client.BytesFromStackItem(prms[0])