Skip to content

Commit

Permalink
fix(executor): group execution rescue & wrap rescue for error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
devnote-dev committed Aug 4, 2024
1 parent feef890 commit 87d2184
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/cling/executor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ module Cling::Executor
resolved_command,
resolved_command.pre_run(executed.parsed_arguments, executed.parsed_options)
)
rescue ex : ExitProgram
return ex.code
rescue ex
resolved_command.on_error ex
end

finalize resolved_command, executed
finalize resolved_command, executed

begin
resolved_command.run executed.parsed_arguments, executed.parsed_options
resolved_command.post_run executed.parsed_arguments, executed.parsed_options
rescue ex : ExitProgram
return ex.code
rescue ex
resolved_command.on_error ex
begin
resolved_command.on_error ex
rescue ex : ExitProgram
return ex.code
rescue ex
raise ExecutionError.new "Error while executing command error handler:\n#{ex.message}", cause: ex
end
end

0
Expand Down

0 comments on commit 87d2184

Please sign in to comment.