Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions exe/hanami
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,4 @@ require "hanami/cli"

cli = Dry::CLI.new(Hanami::CLI)
Hanami::CLI::Bundler.require(:cli)

code = catch(:exit) {
begin
cli.call
0
rescue Hanami::CLI::Error => exception
$stderr.puts(exception.message) # rubocop:disable Style/StderrPuts
1
end
}

exit(code)
cli.call
7 changes: 6 additions & 1 deletion lib/hanami/cli/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

module Hanami
module CLI
# This is a `Dry::CLI::ExitError`, so the CLI prints its message to stderr and exits with 1.
#
# @since 0.1.0
# @api public
class Error < StandardError
class Error < Dry::CLI::ExitError
def initialize(message = self.class.name, exit_code: 1)
super
end
end

# @since 2.0.0
Expand Down
Loading