-
Notifications
You must be signed in to change notification settings - Fork 29
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
improve how we show validation errors #1207
Comments
the problem is that our code in This is an example of a place where we do that
but if we return a plain err diff --git a/app/cli/cmd/organization_apitoken_create.go b/app/cli/cmd/organization_apitoken_create.go
index 012663bb..8f8573e5 100644
--- a/app/cli/cmd/organization_apitoken_create.go
+++ b/app/cli/cmd/organization_apitoken_create.go
@@ -42,7 +42,7 @@ func newAPITokenCreateCmd() *cobra.Command {
res, err := action.NewAPITokenCreate(actionOpts).Run(context.Background(), name, description, duration)
if err != nil {
- return fmt.Errorf("creating API token: %w", err)
+ return err
}
if flagOutputFormat == "token" {
diff --git a/app/cli/internal/action/apitoken_create.go b/app/cli/internal/action/apitoken_create.go
index 7c3a7b58..0eba058b 100644
--- a/app/cli/internal/action/apitoken_create.go
+++ b/app/cli/internal/action/apitoken_create.go
@@ -18,7 +18,6 @@ package action
import (
"context"
"errors"
- "fmt"
"time"
pb "github.com/chainloop-dev/chainloop/app/controlplane/api/controlplane/v1"
@@ -43,7 +42,7 @@ func (action *APITokenCreate) Run(ctx context.Context, name, description string,
resp, err := client.Create(ctx, req)
if err != nil {
- return nil, fmt.Errorf("creating API token: %w", err)
+ return nil, err
}
p := resp.Result
~
~
~ the error looks like this
ideally we should be able to find gRPC errors inside wrapped errors but I am not sure it's possible, otherwise we should just make sure to return naked gRPC errors. |
Discussion on this matter here grpc/grpc-go#2934 where I am extracting two interesting data-points.
|
so we have that code and seems to be working, wrapped gRPC errors are properly returned to their status counterparts, the issue though is that if they come wrapped, the and it seems to be overridden, I do not think there is a way to get the original message. |
We are currently showing validations errors like this excerpt from #1206
we should ideally show just
in theory we have some error handling in the cli
main.go
file but it doesn't seem to be working for this specific error type.The text was updated successfully, but these errors were encountered: