forked from TrueCloudLab/frostfs-node
[#1156] ape: Return not found
when removing local overrides
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
a849236b68
commit
a90310335d
1 changed files with 5 additions and 8 deletions
|
@ -174,10 +174,8 @@ func (s *Server) RemoveChainLocalOverride(_ context.Context, req *control.Remove
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = s.localOverrideStorage.LocalStorage().RemoveOverride(apechain.Ingress, target, apechain.ID(req.GetBody().GetChainId())); err != nil {
|
if err = s.localOverrideStorage.LocalStorage().RemoveOverride(apechain.Ingress, target, req.GetBody().GetChainId()); err != nil {
|
||||||
if code := getCodeByLocalStorageErr(err); code != codes.NotFound {
|
return nil, status.Error(getCodeByLocalStorageErr(err), err.Error())
|
||||||
return nil, status.Error(code, err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resp := &control.RemoveChainLocalOverrideResponse{
|
resp := &control.RemoveChainLocalOverrideResponse{
|
||||||
Body: &control.RemoveChainLocalOverrideResponse_Body{},
|
Body: &control.RemoveChainLocalOverrideResponse_Body{},
|
||||||
|
@ -200,9 +198,7 @@ func (s *Server) RemoveChainLocalOverridesByTarget(_ context.Context, req *contr
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = s.localOverrideStorage.LocalStorage().RemoveOverridesByTarget(apechain.Ingress, target); err != nil {
|
if err = s.localOverrideStorage.LocalStorage().RemoveOverridesByTarget(apechain.Ingress, target); err != nil {
|
||||||
if code := getCodeByLocalStorageErr(err); code != codes.NotFound {
|
return nil, status.Error(getCodeByLocalStorageErr(err), err.Error())
|
||||||
return nil, status.Error(code, err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resp := &control.RemoveChainLocalOverridesByTargetResponse{
|
resp := &control.RemoveChainLocalOverridesByTargetResponse{
|
||||||
Body: &control.RemoveChainLocalOverridesByTargetResponse_Body{},
|
Body: &control.RemoveChainLocalOverridesByTargetResponse_Body{},
|
||||||
|
@ -246,7 +242,8 @@ func (s *Server) ListTargetsLocalOverrides(_ context.Context, req *control.ListT
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCodeByLocalStorageErr(err error) codes.Code {
|
func getCodeByLocalStorageErr(err error) codes.Code {
|
||||||
if errors.Is(err, engine.ErrChainNotFound) || errors.Is(err, engine.ErrChainNameNotFound) {
|
if errors.Is(err, engine.ErrChainNotFound) || errors.Is(err, engine.ErrChainNameNotFound) ||
|
||||||
|
errors.Is(err, engine.ErrResourceNotFound) {
|
||||||
return codes.NotFound
|
return codes.NotFound
|
||||||
}
|
}
|
||||||
return codes.Internal
|
return codes.Internal
|
||||||
|
|
Loading…
Reference in a new issue