-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Re-order return value properties #801
Conversation
|
||
if (all !== undefined) { | ||
error.all = all; | ||
} | ||
|
||
error.stdio = stdio; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stdout
/stderr
/all
/stdio
are potentially big, so they are put last.
@@ -84,27 +84,29 @@ export const makeError = ({ | |||
error.shortMessage = shortMessage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error.*message
is the most important, so should come first.
@@ -84,27 +84,29 @@ export const makeError = ({ | |||
error.shortMessage = shortMessage; | |||
error.command = command; | |||
error.escapedCommand = escapedCommand; | |||
error.cwd = cwd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command's request properties (command
and cwd
) come before the result ones (exitCode
, etc.).
error.failed = true; | ||
error.timedOut = Boolean(timedOut); | ||
error.isCanceled = isCanceled; | ||
error.isTerminated = signal !== undefined; | ||
error.exitCode = exitCode; | ||
error.signal = signal; | ||
error.signalDescription = signalDescription; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean result properties like timedOut
come before more descriptive ones like exitCode
and signal
.
|
||
This is `undefined` when the process could not be spawned or was terminated by a [signal](#signal-1). | ||
The `cwd` of the command if provided in the [command options](#cwd-1). Otherwise it is `process.cwd()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-orders the documentation too.
This re-orders the properties of the Execa return value (on success or error). When the result is printed, that order is preserved, so this PR makes them follow a logical order.
Also, this adds a test to make sure we are not missing properties, which avoids bugs like #798.