mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-01-18 13:57:34 +00:00
cli: extend object attribute parsing error in upload-bin
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
5b793bcf1b
commit
8b43c33e44
1 changed files with 6 additions and 1 deletions
|
@ -483,7 +483,12 @@ func uploadObj(ctx context.Context, p *pool.Pool, signer user.Signer, owner util
|
||||||
func getBlockIndex(header *object.Object, attribute string) (int, error) {
|
func getBlockIndex(header *object.Object, attribute string) (int, error) {
|
||||||
for _, attr := range header.UserAttributes() {
|
for _, attr := range header.UserAttributes() {
|
||||||
if attr.Key() == attribute {
|
if attr.Key() == attribute {
|
||||||
return strconv.Atoi(attr.Value())
|
value := attr.Value()
|
||||||
|
blockIndex, err := strconv.Atoi(value)
|
||||||
|
if err != nil {
|
||||||
|
return -1, fmt.Errorf("attribute %s has invalid value: %s, error: %w", attribute, value, err)
|
||||||
|
}
|
||||||
|
return blockIndex, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1, fmt.Errorf("attribute %s not found", attribute)
|
return -1, fmt.Errorf("attribute %s not found", attribute)
|
||||||
|
|
Loading…
Reference in a new issue