[#xxx] client: move isClientErrMaintenance
to frostfs-sdk-go #165
2 changed files with 10 additions and 0 deletions
|
@ -61,6 +61,13 @@ func IsErrSessionNotFound(err error) bool {
|
||||||
return wrapsErrType[*apistatus.SessionTokenNotFound](err)
|
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.
|
// 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)
|
||||||
|
|
|
@ -36,6 +36,9 @@ func TestErrors(t *testing.T) {
|
||||||
}, {
|
}, {
|
||||||
check: client.IsErrSessionNotFound,
|
check: client.IsErrSessionNotFound,
|
||||||
err: new(apistatus.SessionTokenNotFound),
|
err: new(apistatus.SessionTokenNotFound),
|
||||||
|
}, {
|
||||||
|
check: client.IsErrMaintenance,
|
||||||
|
err: new(apistatus.NodeUnderMaintenance),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue