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

Add error.originalMessage property #373

Merged
merged 3 commits into from Oct 8, 2019
Merged

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Oct 6, 2019

When an error event is thrown on the child process or when a timeout happens, we re-use the original Error instance instead of creating a new one. However we override the error.message.

This PR keep the original error.message as an additional property error.originalMessage.

I need this for one my projects using Execa. That project should proxy a user's command in such a way that users should not be aware of that proxy. In particular, the error messages produced by Execa should be not printed to the console. However the error messages coming from error events on the child process (such as command not found) should be printed. This PR allows for this to happen.

index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
@ehmicky
Copy link
Collaborator Author

ehmicky commented Oct 8, 2019

Fixed :)

@sindresorhus sindresorhus changed the title Add error.originalMessage Add error.originalMessage property Oct 8, 2019
@sindresorhus sindresorhus merged commit 07d2b76 into master Oct 8, 2019
@sindresorhus sindresorhus deleted the feat/original-message branch October 8, 2019 14:55
ehmicky added a commit that referenced this pull request Oct 9, 2019
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 this pull request may close these issues.

None yet

2 participants