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

CLI exceptions show up as readable return values instead of backtrace. #440

Merged
merged 3 commits into from Dec 10, 2017

Conversation

elorest
Copy link
Member

@elorest elorest commented Dec 9, 2017

Description of the Change

Makes error messages look better by using CLI exit! command.

Copy link
Contributor

@eliasjpr eliasjpr left a comment

Choose a reason for hiding this comment

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

Exit exit good bye!

I like this. I think you might be missing some more exists see comments.

@@ -89,7 +87,7 @@ module Amber::CLI
Micrate::DB.connection_url = url.gsub(path, "/#{uri.scheme}")
return path.gsub("/", "")
else
raise "could not determine database name"
raise "Could not determine database name"
Copy link
Contributor

Choose a reason for hiding this comment

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

Use exit here as well

Copy link
Member Author

Choose a reason for hiding this comment

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

This is within the scope of the main rescue in run. Raising here is more object oriented as exiting is a way that we handle exceptions, not a replacement for exceptions.

@@ -19,6 +19,10 @@ module Amber::CLI
encrypted_file = "config/environments/.#{env}.enc"
unencrypted_file = "config/environments/#{env}.yml"

unless File.exists?(unencrypted_file) || File.exists?(encrypted_file)
raise Exceptions::Environment.new("./config/environments/", env)
Copy link
Contributor

Choose a reason for hiding this comment

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

Exit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Also covered by existing rescue block. This is necessary for consistent messages.

Again exiting isn't supposed to replace exceptions just handle them in a prettier way for the CLI.

@elorest elorest merged commit 7aa7800 into master Dec 10, 2017
@eliasjpr eliasjpr deleted the is/better_cli_errors branch January 12, 2018 01:04
@faustinoaq faustinoaq added this to Done in Framework 2018 May 5, 2018
@faustinoaq faustinoaq removed this from Done in Framework 2018 Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants