-
Notifications
You must be signed in to change notification settings - Fork 156
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
feat: informative error message #859
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: VoVAllen The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found error trace is not informative in most cases. Finally decide not to add it. Only debug mode will print the full error stacktrace.
Other changes:
- For buildkit error, it will print the full error trace for user easier to understand the detailed error
- Starlark list -> String slice will panic before if element is not string inside the list. Now check before conversion
@@ -280,7 +290,8 @@ func (b generalBuilder) build(ctx context.Context, pw progresswriter.Writer) err | |||
} | |||
_, err := b.Client.Build(ctx, solveOpt, "envd", b.BuildFunc(), pw.Status()) | |||
if err != nil { | |||
err = errors.Wrap(err, "failed to solve LLB") | |||
err = errors.Wrap(&BuildkitdErr{err: err}, "Buildkit error") | |||
logrus.Errorf("%+v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w to format errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentional. %+v is a feature of cockroachdb/errors
to print the full error messages including stacktrace.
if ok := errors.As(err, &evalErr); ok { | ||
fmt.Fprintln(os.Stderr, evalErr.Backtrace()) | ||
} else if ok := errors.As(err, &syntaxErr); ok { | ||
fmt.Fprintln(os.Stderr, syntaxErr) | ||
} else if ok := errors.As(err, &resolveErr); ok { | ||
fmt.Fprintf(os.Stderr, "%+v\n", resolveErr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %w to format errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
LGTM /cc @kemingy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/LGTM |
Signed-off-by: Jinjing.Zhou allenzhou@tensorchord.ai