[#1156] ape: Return not found
when removing local overrides
All checks were successful
DCO action / DCO (pull_request) Successful in 8m4s
Build / Build Components (1.21) (pull_request) Successful in 9m45s
Vulncheck / Vulncheck (pull_request) Successful in 9m20s
Build / Build Components (1.22) (pull_request) Successful in 14m16s
Pre-commit hooks / Pre-commit (pull_request) Successful in 22m34s
Tests and linters / gopls check (pull_request) Successful in 7m10s
Tests and linters / Staticcheck (pull_request) Successful in 7m22s
Tests and linters / Lint (pull_request) Successful in 8m21s
Tests and linters / Tests (1.21) (pull_request) Successful in 11m53s
Tests and linters / Tests (1.22) (pull_request) Successful in 11m54s
Tests and linters / Tests with -race (pull_request) Successful in 12m14s
All checks were successful
DCO action / DCO (pull_request) Successful in 8m4s
Build / Build Components (1.21) (pull_request) Successful in 9m45s
Vulncheck / Vulncheck (pull_request) Successful in 9m20s
Build / Build Components (1.22) (pull_request) Successful in 14m16s
Pre-commit hooks / Pre-commit (pull_request) Successful in 22m34s
Tests and linters / gopls check (pull_request) Successful in 7m10s
Tests and linters / Staticcheck (pull_request) Successful in 7m22s
Tests and linters / Lint (pull_request) Successful in 8m21s
Tests and linters / Tests (1.21) (pull_request) Successful in 11m53s
Tests and linters / Tests (1.22) (pull_request) Successful in 11m54s
Tests and linters / Tests with -race (pull_request) Successful in 12m14s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
8fcd0f8f8d
commit
e55cddead3
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