Throw a nice error when attempting to set the account outside of a git project
searls opened this issue · 2 comments
searls commented
I accidentally tried setting the account from the wrong directory, and while it tried changing the git remote, it blew up instead of giving a decent error message. Would it be better to print an error message here that you must be in a git project with a heroku remote?
$ heroku accounts:set personal
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: undefined method `each' for nil:NilClass (NoMethodError)
Backtrace: /Users/justin/.heroku/plugins/heroku-accounts/lib/accounts/heroku/command/accounts.rb:112:in `set'
/Users/justin/.heroku/client/lib/heroku/command.rb:217:in `run'
/Users/justin/.heroku/client/lib/heroku/cli.rb:40:in `start'
/usr/local/heroku/bin/heroku:24:in `<main>'
Command: heroku accounts:set testdouble
Plugins: heroku-accounts
Version: heroku-toolbelt/3.17.1 (x86_64-darwin10.8.0) ruby/1.9.3
ddollar commented
Yep, that sounds like it'd be a nice change. If you're interested in putting together a pull request I'd merge it.
searls commented
Submitted via the web editor, like a boss.