[#108] object/head: Return 404 error if header was not found

Define ErrNotFound error in headsvc package. Return ErrNotFound from Head
method if the header was not found in the container.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Leonard Lyubich 2020-10-21 12:15:54 +03:00 committed by Leonard Lyubich
parent ae0dd9e051
commit 5ad0df7794
2 changed files with 3 additions and 1 deletions

View File

@ -135,7 +135,7 @@ loop:
}
if !h.traverser.Success() {
return nil, errors.Errorf("(%T) incomplete object Head operation", h)
return nil, errors.Wrapf(ErrNotFound, "(%T) incomplete object Head operation", h)
}
return resp, nil

View File

@ -39,6 +39,8 @@ type cfg struct {
rightChildSearcher RelationSearcher
}
var ErrNotFound = errors.New("object header not found")
func defaultCfg() *cfg {
return &cfg{
workerPool: new(util.SyncWorkerPool),