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

Include stdout/stderr in error.message #395

Closed
sindresorhus opened this issue Dec 6, 2019 · 1 comment · Fixed by #397
Closed

Include stdout/stderr in error.message #395

sindresorhus opened this issue Dec 6, 2019 · 1 comment · Fixed by #397

Comments

@sindresorhus
Copy link
Owner

We removed it in execa v2 for some reason, but it's very useful.

The lack of it leads to a lot of annoyance and makes it harder for users to see what actually went wrong...

It also makes it harder to do test assertions like this:

test('missing file operands', async t => {
	await t.throwsAsync(execa('./cli.js'), /`source` and `destination` required/);
});

Open questions:

  • Should we include stdout or only stderr?
  • Should we truncate it at some length?
@ehmicky
Copy link
Collaborator

ehmicky commented Dec 6, 2019

Following from some discussion with @sindresorhus, we thought of the following solution:

  • error.message should include prefixes (e.g. Command failed with exit code) and be appended with stdout and stderr (if they exist)
  • error.shortMessage should include prefixes but not stdout/stderr
  • error.originalMessage should include neither prefixes nor stdout/stderr

This would be a breaking change.

mterrel pushed a commit to unboundedsystems/adapt that referenced this issue Oct 12, 2020
See sindresorhus/execa#395 for more info on
the execa v4 changes to error reporting.
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 a pull request may close this issue.

2 participants