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
Conversation
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.
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" |
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.
Use exit here as well
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.
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) |
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.
Exit?
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.
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.
Description of the Change
Makes error messages look better by using CLI
exit!
command.