forked from TrueCloudLab/frostfs-sdk-go
pool: Replace IsErrXXX functions with errors
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
This commit is contained in:
parent
7d2cfff825
commit
f1b438a2ac
2 changed files with 7 additions and 10 deletions
|
@ -31,14 +31,13 @@ import (
|
|||
// Each method which produces a NeoFS API call may return a server response.
|
||||
// Status responses are returned in the result structure, and can be cast
|
||||
// to built-in error instance (or in the returned error if the client is
|
||||
// configured accordingly). Certain statuses can be checked using `apistatus`
|
||||
// and standard `errors` packages. Note that package provides some helper
|
||||
// functions to work with status returns (e.g. IsErrContainerNotFound).
|
||||
// configured accordingly). Certain statuses can be checked using [apistatus]
|
||||
// and standard [errors] packages.
|
||||
// All possible responses are documented in methods, however, some may be
|
||||
// returned from all of them (pay attention to the presence of the pointer sign):
|
||||
// - *apistatus.ServerInternal on internal server error;
|
||||
// - *apistatus.NodeUnderMaintenance if a server is under maintenance;
|
||||
// - *apistatus.SuccessDefaultV2 on default success.
|
||||
// - *[apistatus.ServerInternal] on internal server error;
|
||||
// - *[apistatus.NodeUnderMaintenance] if a server is under maintenance;
|
||||
// - *[apistatus.SuccessDefaultV2] on default success.
|
||||
//
|
||||
// Client MUST NOT be copied by value: use pointer to Client instead.
|
||||
//
|
||||
|
|
|
@ -1527,8 +1527,6 @@ type resCreateSession struct {
|
|||
// Each method which produces a NeoFS API call may return an error.
|
||||
// Status of underlying server response is casted to built-in error instance.
|
||||
// Certain statuses can be checked using `sdkClient` and standard `errors` packages.
|
||||
// Note that package provides some helper functions to work with status returns
|
||||
// (e.g. sdkClient.IsErrContainerNotFound, sdkClient.IsErrObjectNotFound).
|
||||
//
|
||||
// See pool package overview to get some examples.
|
||||
type Pool struct {
|
||||
|
@ -1860,7 +1858,7 @@ func (p *Pool) checkSessionTokenErr(err error, address string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if sdkClient.IsErrSessionNotFound(err) || sdkClient.IsErrSessionExpired(err) {
|
||||
if errors.Is(err, apistatus.ErrSessionTokenNotFound) || errors.Is(err, apistatus.ErrSessionTokenExpired) {
|
||||
p.cache.DeleteByPrefix(address)
|
||||
return true
|
||||
}
|
||||
|
@ -2458,7 +2456,7 @@ func waitForContainerRemoved(ctx context.Context, cli client, cnrID *cid.ID, wai
|
|||
|
||||
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
||||
_, err := cli.containerGet(ctx, prm)
|
||||
return sdkClient.IsErrContainerNotFound(err)
|
||||
return errors.Is(err, apistatus.ErrContainerNotFound)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue