Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show only grpc error #1236

Merged
merged 2 commits into from
Aug 16, 2024
Merged

Conversation

migmartri
Copy link
Member

@migmartri migmartri commented Aug 15, 2024

Shows just the gRPC error not the whole wrapped chain to the user for expected gRPC errors.

Examples

Before

$ go run main.go --insecure org api-token create --name test
ERR creating API token: creating API token: rpc error: code = AlreadyExists desc = duplicated: name already taken

after

$ go run main.go --insecure org api-token create --name test
ERR duplicated: name already taken

before

$ go run main.go --insecure org api-token create --name test_foo
ERR creating API token: creating API token: rpc error: code = InvalidArgument desc = validation error: "test_foo": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

after

$ go run main.go --insecure org api-token create --name test_foo
ERR validation error: "test_foo": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

fixes #1207

Signed-off-by: Miguel <miguel@chainloop.dev>
Signed-off-by: Miguel <miguel@chainloop.dev>
@migmartri migmartri requested review from jiparis and javirln August 15, 2024 08:25
@migmartri migmartri merged commit 351ec02 into chainloop-dev:main Aug 16, 2024
13 checks passed
@migmartri migmartri deleted the fix-error-message branch August 16, 2024 09:21
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.

improve how we show validation errors
3 participants