[#746] morph/client: Break loop in iterateClients on NeoFS error

There is no need to continue iterating over Neo RPC endpoints in case of
some address-independent error (e.g. NeoFS logic error).

Unwrap and immediately return `neofsError` errors from loop in
`iterateClients`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-08-31 13:29:43 +03:00 committed by Alex Vanin
parent a2b81f13b0
commit 18c49c2cb9

View file

@ -94,6 +94,11 @@ func (x *multiClient) iterateClients(f func(*Client) error) error {
return nil return nil
} }
// we dont need to continue the process after the logical error was encountered
if errNeoFS := unwrapNeoFSError(err); errNeoFS != nil {
return errNeoFS
}
// set first error once // set first error once
if firstErr == nil { if firstErr == nil {
firstErr = err firstErr = err