diff --git a/src/cligen/app.cr b/src/cligen/app.cr index 554b753..19fec0f 100644 --- a/src/cligen/app.cr +++ b/src/cligen/app.cr @@ -18,9 +18,9 @@ module CliGen super end - def self.handle_command_raises(&block) : Nil + def self.handle_command_raises(&) : Nil begin - block.call + yield rescue e : CliGen::RuntimeError abort e.message rescue e : CliGen::ConfigurationError diff --git a/src/cligen/command_node.cr b/src/cligen/command_node.cr index d752dcc..5cfb0a6 100644 --- a/src/cligen/command_node.cr +++ b/src/cligen/command_node.cr @@ -75,9 +75,9 @@ module CliGen @flags.find{|f| f.short == short} end - def handle_flag_raises(&work) + def handle_flag_raises(&) : Nil begin - work.call + yield rescue e : CliGen::RuntimeError abort e.message end