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

Improve documentation of error.* fields #1006

Merged
merged 1 commit into from
May 1, 2024
Merged

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented May 1, 2024

This PR documents the error-related fields as error.* instead of result.*.

Technically, on success, result.timedOut, result.isCanceled, result.isMaxBuffer and result.isTerminated are false, and result.exitCode is 0. However, those are defined on success mostly for orthogonality reasons.

Users should instead check whether the subprocess failed first. If not, they do not need to check those properties. They can check whether the subprocess failed by using reject: true (the default value), error.failed, or error instanceof ExecaError.

Documenting those fields as error.* makes it clearer that those are intended for subprocess failures.

@sindresorhus sindresorhus merged commit 4ee0dec into main May 1, 2024
12 checks passed
@sindresorhus sindresorhus deleted the doc-error-fields branch May 1, 2024 20:15
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