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

Command Errors Should Not Be Rescued #47

Merged
merged 6 commits into from
Mar 25, 2015
Merged

Command Errors Should Not Be Rescued #47

merged 6 commits into from
Mar 25, 2015

Conversation

bbergstrom
Copy link
Contributor

A command error should halt further actions, bubble up and return a non-zero from octopolo. If something goes wrong with a command, we likely don't want to continue actions in an unknown state. Also, for using octopolo in scripting it is useful to have a non-zero return code when something went wrong.

@bbergstrom
Copy link
Contributor Author

This may need to be resolved so things don't break.
#48

@bbergstrom
Copy link
Contributor Author

brianbergstrom@bb-mbp octopolo (cli-error-fix)$ bundle exec op new-branch test7
git branch --no-track test7 origin/master
git checkout test7
git push --set-upstream origin test7
Branch test7 set up to track remote branch test7 from origin.
brianbergstrom@bb-mbp octopolo (test7)$ 

subject.should_receive(:say).with(command)
Open3.should_receive(:capture3).with(command).and_raise(exception_message)
subject.should_receive(:say).with("Unable to perform '#{command}': #{exception_message}")
subject.perform(command).should be_nil
expect do

Choose a reason for hiding this comment

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

typically we do these on one line.

Choose a reason for hiding this comment

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

also using the return value of a block means using {} instead of do-end according to our style guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was past the 120 character mark so i split it up. Which style issue is worse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll switch to curly and do a line continuation.

@anfleene
Copy link

👍

bbergstrom added a commit that referenced this pull request Mar 25, 2015
Command Errors Should Not Be Rescued
@bbergstrom bbergstrom merged commit d2433b0 into master Mar 25, 2015
@emmahsax emmahsax deleted the cli-error-fix branch July 14, 2020 07:58
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