client: Move isClientErrMaintenance from frostfs-node #228

Merged
fyrchik merged 1 commit from elebedeva/frostfs-sdk-go:fix/move-maintenance-err-check-from-node into master 2024-06-18 05:38:25 +00:00
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)
}
// 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.
func newErrMissingResponseField(name string) error {
return fmt.Errorf("missing %s field in the response", name)

View file

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