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

feat: informative error message #859

Merged
merged 12 commits into from
Sep 19, 2022
Merged

feat: informative error message #859

merged 12 commits into from
Sep 19, 2022

Conversation

VoVAllen
Copy link
Member

@VoVAllen VoVAllen commented Sep 9, 2022

Signed-off-by: Jinjing.Zhou allenzhou@tensorchord.ai

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
@muniu-bot
Copy link

muniu-bot bot commented Sep 9, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@muniu-bot muniu-bot bot added the approved label Sep 9, 2022
@kemingy kemingy linked an issue Sep 9, 2022 that may be closed by this pull request
Signed-off-by: VoVAllen <allenzhou@tensorchord.ai>
Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
@VoVAllen VoVAllen changed the title WIP feat: informative error message feat: informative error message Sep 16, 2022
Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
Copy link
Member Author

@VoVAllen VoVAllen left a 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

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
@@ -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)
Copy link
Member

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

Copy link
Member Author

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)
Copy link
Member

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

Copy link
Member Author

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>
Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
@gaocegege
Copy link
Member

LGTM

/cc @kemingy

Copy link
Member

@kemingy kemingy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@gaocegege
Copy link
Member

/LGTM

@muniu-bot muniu-bot bot added the lgtm label Sep 19, 2022
@muniu-bot muniu-bot bot merged commit eecc7cf into tensorchord:main Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

enhancement(network error): Make error message more informative
4 participants