File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -41,16 +41,28 @@ module Cling::Executor
4141 def self.handle (command : Command , results : Array (Parser ::Result )) : Int32
4242 resolved_command = resolve_command command, results
4343 unless resolved_command
44- # TODO: should this be an ExecutionError?
45- command.on_error CommandError .new(" Command '#{ results.first.value } ' not found" )
46- return 1
44+ begin
45+ # TODO: should this be an ExecutionError?
46+ command.on_error CommandError .new(" Command '#{ results.first.value } ' not found" )
47+ return 1
48+ rescue ex : ExitProgram
49+ return ex.code
50+ rescue ex
51+ raise ExecutionError .new " Error while executing command error handler:\n #{ ex.message } " , cause: ex
52+ end
4753 end
4854
4955 begin
5056 executed = get_in_position resolved_command, results
5157 rescue ex : ExecutionError
52- resolved_command.on_invalid_option ex.to_s
53- return 1
58+ begin
59+ resolved_command.on_invalid_option ex.to_s
60+ return 1
61+ rescue ex : ExitProgram
62+ return ex.code
63+ rescue ex
64+ raise ExecutionError .new " Error while executing command error handler:\n #{ ex.message } " , cause: ex
65+ end
5466 end
5567
5668 begin
You can’t perform that action at this time.
0 commit comments