diff --git a/client/errors.go b/client/errors.go index 64144b6..fbd70ae 100644 --- a/client/errors.go +++ b/client/errors.go @@ -61,6 +61,13 @@ func IsErrSessionNotFound(err error) bool { return wrapsErrType[*apistatus.SessionTokenNotFound](err) } +// IsErrMaintenance checks if err corresponds to FrostFS status return +// which tells that node is currently under maintenance. Supports wrapped +// errors. +func IsErrMaintenance(err error) bool { + return wrapsErrType[*apistatus.NodeUnderMaintenance](err) +} + // returns error describing missing field with the given name. func newErrMissingResponseField(name string) error { return fmt.Errorf("missing %s field in the response", name) diff --git a/client/errors_test.go b/client/errors_test.go index 90114d7..9fa07a3 100644 --- a/client/errors_test.go +++ b/client/errors_test.go @@ -36,6 +36,9 @@ func TestErrors(t *testing.T) { }, { check: client.IsErrSessionNotFound, err: new(apistatus.SessionTokenNotFound), + }, { + check: client.IsErrMaintenance, + err: new(apistatus.NodeUnderMaintenance), }, }