[#xx] cli: Print the reason of ape manager error
Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 2m42s
DCO action / DCO (pull_request) Failing after 3m11s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m53s
Vulncheck / Vulncheck (pull_request) Successful in 3m40s
Tests and linters / Staticcheck (pull_request) Successful in 4m16s
Tests and linters / gopls check (pull_request) Successful in 4m18s
Tests and linters / Lint (pull_request) Successful in 5m41s
Build / Build Components (pull_request) Successful in 5m47s
Tests and linters / Tests (pull_request) Successful in 8m46s
Tests and linters / Tests with -race (pull_request) Successful in 8m50s
Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 2m42s
DCO action / DCO (pull_request) Failing after 3m11s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m53s
Vulncheck / Vulncheck (pull_request) Successful in 3m40s
Tests and linters / Staticcheck (pull_request) Successful in 4m16s
Tests and linters / gopls check (pull_request) Successful in 4m18s
Tests and linters / Lint (pull_request) Successful in 5m41s
Build / Build Components (pull_request) Successful in 5m47s
Tests and linters / Tests (pull_request) Successful in 8m46s
Tests and linters / Tests with -race (pull_request) Successful in 8m50s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
99f9e59de9
commit
86d6001170
1 changed files with 7 additions and 2 deletions
|
@ -26,13 +26,15 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
||||||
_ = iota
|
_ = iota
|
||||||
internal
|
internal
|
||||||
aclDenied
|
aclDenied
|
||||||
|
apemanagerDenied
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
code int
|
code int
|
||||||
|
|
||||||
internalErr = new(sdkstatus.ServerInternal)
|
internalErr = new(sdkstatus.ServerInternal)
|
||||||
accessErr = new(sdkstatus.ObjectAccessDenied)
|
accessErr = new(sdkstatus.ObjectAccessDenied)
|
||||||
|
apemanagerErr = new(sdkstatus.APEManagerAccessDenied)
|
||||||
)
|
)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
@ -41,6 +43,9 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
||||||
case errors.As(err, &accessErr):
|
case errors.As(err, &accessErr):
|
||||||
code = aclDenied
|
code = aclDenied
|
||||||
err = fmt.Errorf("%w: %s", err, accessErr.Reason())
|
err = fmt.Errorf("%w: %s", err, accessErr.Reason())
|
||||||
|
case errors.As(err, &apemanagerErr):
|
||||||
|
code = apemanagerDenied
|
||||||
|
err = fmt.Errorf("%w: %s", err, apemanagerErr.Reason())
|
||||||
default:
|
default:
|
||||||
code = internal
|
code = internal
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue