Skip to content

[errors] Show better errors when user script errors out and fix poetry plugin #1511

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

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/boxcli/midcobra/midcobra.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (ex *midcobraExecutable) Execute(ctx context.Context, args []string) int {
var exitErr *exec.ExitError
var userExecErr *usererr.ExitError
if errors.As(err, &userExecErr) {
ux.Ferror(ex.cmd.ErrOrStderr(), userExecErr.Error()+"\n")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion. Also print the Stderr since it may have other info.

We do similar in midcobra/debug.go: https://github.com/jetpack-io/devbox/blob/42d2f713fde840558faeb9d404b8f5e9e2f697dd/internal/boxcli/midcobra/debug.go#L67

return userExecErr.ExitCode()
}
if errors.As(err, &exitErr) {
Expand Down
6 changes: 3 additions & 3 deletions plugins/poetry.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "poetry",
"version": "0.0.1",
"readme": "This plugin automatically configures poetry to use the version of python installed in your Devbox shell, instead of the Python version that it is bundled with.",
"version": "0.0.2",
"readme": "This plugin automatically configures poetry to use the version of python installed in your Devbox shell, instead of the Python version that it is bundled with. Your pyproject.toml must be in the same directory as your devbox.json.",
"env": {
"POETRY_VIRTUALENVS_IN_PROJECT": "true",
"POETRY_VIRTUALENVS_CREATE": "true",
"POETRY_VIRTUALENVS_PATH": "{{.Virtenv}}/.virtualenvs"
},
"shell": {
"init_hook": [
"poetry env use $(command -v python) --quiet --no-interaction"
"poetry env use $(command -v python) --no-interaction"
]
}
}