Skip to content

Conversation

@nfischer
Copy link
Member

This is a redo of #269.

This adds error codes as a .code attribute to ShellStrings, but doesn't implement the errorCode() function.

This also does not switch the implementation of the error() function (that should be in another PR, IMO).

Tests will be added soon.

@nfischer
Copy link
Member Author

@ariporad @levithomason This should be ready for review.

This adds the .code attribute to everything.

If we like this implementation and merge this, we can open a new PR to change error() to return the code instead of the last command's error string. I didn't include it in this PR because error codes themselves shouldn't be a breaking change, and it's easy enough to swap that implementation in a separate PR.

I left this as 2 commits, since the first one adds error codes, and the second one refactors everything to return a ShellString (which gives every command the .code and .stderr attributes). Feel free to squash if you prefer.

//

// no piped methods for commands that don't return anything
assert.throws(function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this get removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Almost every command returns a ShellString now. So the number of "commands that don't return anything" has shrunk to almost zero.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK.

@ariporad
Copy link
Contributor

LGTM!

ariporad added a commit that referenced this pull request Mar 17, 2016
feat: adding error codes to ShellJS
@ariporad ariporad merged commit f006fcd into master Mar 17, 2016
@ariporad ariporad deleted the feat-error-codes branch March 17, 2016 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants