Skip to content

Use gRPC error codes instead of fmt.Errorf#532

Merged
merenbach merged 1 commit intoargoproj:masterfrom
merenbach:512-better-error-codes
Aug 28, 2018
Merged

Use gRPC error codes instead of fmt.Errorf#532
merenbach merged 1 commit intoargoproj:masterfrom
merenbach:512-better-error-codes

Conversation

@merenbach
Copy link
Contributor

@merenbach merenbach commented Aug 23, 2018

Closes #512

Output with this patch when adding, for instance, an app at an invalid path, yielding an embedded FailedPrecondition error code:

$ ./dist/argocd app create --name guestbook-default --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook2 --env default --dest-server https://`minikube ip`:8443
FATA[0004] rpc error: code = InvalidArgument desc = application spec is invalid: InvalidSpecError: Destination server and/or namespace missing from app spec;InvalidSpecError: Unable to generate manifests in guestbook2: rpc error: code = FailedPrecondition desc = Failed to read dir /var/folders/cf/yq01t3c11s51x5fqkn8065p1jvtw07/T/https:__github.com_argoproj_argocd-example-apps.git/guestbook2: open /var/folders/cf/yq01t3c11s51x5fqkn8065p1jvtw07/T/https:__github.com_argoproj_argocd-example-apps.git/guestbook2: no such file or directory 

Before the patch, the embedded error has a code of Unknown:

$ ./dist/argocd app create --name guestbook-default --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook2 --env default --dest-server https://`minikube ip`:8443
FATA[0006] rpc error: code = InvalidArgument desc = application spec is invalid: InvalidSpecError: Destination server and/or namespace missing from app spec;InvalidSpecError: Unable to generate manifests in guestbook2: rpc error: code = Unknown desc = Failed to read dir /var/folders/cf/yq01t3c11s51x5fqkn8065p1jvtw07/T/https:__github.com_argoproj_argocd-example-apps.git/guestbook2: open /var/folders/cf/yq01t3c11s51x5fqkn8065p1jvtw07/T/https:__github.com_argoproj_argocd-example-apps.git/guestbook2: no such file or directory

@merenbach merenbach changed the title [WIP] Use gRPC error codes instead of fmt.Errorf Use gRPC error codes instead of fmt.Errorf Aug 24, 2018
@merenbach merenbach requested a review from jessesuen August 24, 2018 21:38
@merenbach merenbach changed the title Use gRPC error codes instead of fmt.Errorf [WIP] Use gRPC error codes instead of fmt.Errorf Aug 24, 2018
@merenbach merenbach changed the title [WIP] Use gRPC error codes instead of fmt.Errorf Use gRPC error codes instead of fmt.Errorf Aug 27, 2018
@merenbach merenbach merged commit d47b7e6 into argoproj:master Aug 28, 2018
@merenbach merenbach deleted the 512-better-error-codes branch August 28, 2018 00:54
leoluz pushed a commit to leoluz/argo-cd that referenced this pull request Sep 29, 2023
* feat: respect rbac for resource exclusions

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* feat: use list call to check for permissions

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* feat: updated implementation to handle different levels of rbac check

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* feat: fixed linter error

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* feat: resolve review comments

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

---------

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants