[#228] client: Move isClientErrMaintenance from node

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2024-06-17 16:58:10 +03:00
parent ebd8fcd168
commit 1a5886e776
2 changed files with 10 additions and 0 deletions

View file

@ -67,6 +67,12 @@ func IsErrAPEManagerAccessDenied(err error) bool {
return wrapsErrType[*apistatus.APEManagerAccessDenied](err) return wrapsErrType[*apistatus.APEManagerAccessDenied](err)
} }
// IsErrNodeUnderMaintenance checks if err corresponds to FrostFS status return
// corresponding to nodes being under maintenance. Supports wrapped errors.
func IsErrNodeUnderMaintenance(err error) bool {
return wrapsErrType[*apistatus.NodeUnderMaintenance](err)
}
// returns error describing missing field with the given name. // returns error describing missing field with the given name.
func newErrMissingResponseField(name string) error { func newErrMissingResponseField(name string) error {
return fmt.Errorf("missing %s field in the response", name) return fmt.Errorf("missing %s field in the response", name)

View file

@ -38,6 +38,10 @@ func TestErrors(t *testing.T) {
check: client.IsErrSessionNotFound, check: client.IsErrSessionNotFound,
err: new(apistatus.SessionTokenNotFound), err: new(apistatus.SessionTokenNotFound),
}, },
{
check: client.IsErrNodeUnderMaintenance,
err: new(apistatus.NodeUnderMaintenance),
},
} }
for i := range errs { for i := range errs {