[#1563] tree: Wrap only ChainRouterError
erros with ObjectAccessDenied
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 3m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m35s
Tests and linters / Staticcheck (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 7m37s
Tests and linters / Run gofumpt (pull_request) Successful in 8m27s
DCO action / DCO (pull_request) Successful in 8m45s
Build / Build Components (pull_request) Successful in 9m50s
Tests and linters / Tests (pull_request) Successful in 10m7s
Tests and linters / Lint (pull_request) Successful in 10m55s
Tests and linters / gopls check (pull_request) Successful in 11m2s
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 3m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m35s
Tests and linters / Staticcheck (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 7m37s
Tests and linters / Run gofumpt (pull_request) Successful in 8m27s
DCO action / DCO (pull_request) Successful in 8m45s
Build / Build Components (pull_request) Successful in 9m50s
Tests and linters / Tests (pull_request) Successful in 10m7s
Tests and linters / Lint (pull_request) Successful in 10m55s
Tests and linters / gopls check (pull_request) Successful in 11m2s
* Such wrapping helps to differentiate logical check errors and server internal errors. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
7115e2ae90
commit
94b0ceb0b8
1 changed files with 7 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
core "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
core "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
||||||
|
checkercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/common/ape"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
||||||
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||||
|
@ -70,6 +71,12 @@ func (s *Service) verifyClient(ctx context.Context, req message, cid cidSDK.ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
func apeErr(err error) error {
|
func apeErr(err error) error {
|
||||||
|
var chRouterErr *checkercore.ChainRouterError
|
||||||
|
if !errors.As(err, &chRouterErr) {
|
||||||
|
errServerInternal := &apistatus.ServerInternal{}
|
||||||
|
apistatus.WriteInternalServerErr(errServerInternal, err)
|
||||||
|
return errServerInternal
|
||||||
|
}
|
||||||
errAccessDenied := &apistatus.ObjectAccessDenied{}
|
errAccessDenied := &apistatus.ObjectAccessDenied{}
|
||||||
errAccessDenied.WriteReason(err.Error())
|
errAccessDenied.WriteReason(err.Error())
|
||||||
return errAccessDenied
|
return errAccessDenied
|
||||||
|
|
Loading…
Reference in a new issue