[SUPPORT]: Ignore ECInfoErr
erros in GetSplitInfo
#313
1 changed files with 2 additions and 1 deletions
|
@ -2985,11 +2985,12 @@ func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tok
|
|||
_, err := p.HeadObject(ctx, prm)
|
||||
|
||||
var errSplit *object.SplitInfoError
|
||||
var errECInfo *object.ECInfoError
|
||||
|
||||
switch {
|
||||
case errors.As(err, &errSplit):
|
||||
return errSplit.SplitInfo(), nil
|
||||
case err == nil:
|
||||
case err == nil || errors.As(err, &errECInfo):
|
||||
elebedeva marked this conversation as resolved
|
||||
return nil, relations.ErrNoSplitInfo
|
||||
default:
|
||||
return nil, fmt.Errorf("failed to get raw object header: %w", err)
|
||||
|
|
Loading…
Reference in a new issue
Why using
errors.As()
here and noterrors.Is()
?errors.Is
checks exact error value (similar to==
check) whileerrors.As
tries to cast error to error type.Exact value check is being used when error is explicitly defined (e.g.
MyError := errors.New("my error"
).@alexvanin is right.
errors.Is
would have been used ifvar errECInfo = errors.New("object not found, ec info provided")
, but it's introduced as complex type with data within