diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 90366f7..a638b3c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --exclude-limit 180` -# on 2023-03-21 23:33:15 UTC using RuboCop version 1.48.1. +# on 2023-04-11 23:33:33 UTC using RuboCop version 1.50.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -115,14 +115,6 @@ Naming/AccessorMethodName: - 'lib/dispatch-rider/handlers/base.rb' - 'lib/dispatch-rider/scheduled_job.rb' -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: PreferredName. -Naming/RescuedExceptionsVariableName: - Exclude: - - 'lib/dispatch-rider/demultiplexer.rb' - - 'lib/dispatch-rider/logging/lifecycle_logger.rb' - # Offense count: 10 RSpec/AnyInstance: Exclude: diff --git a/lib/dispatch-rider/demultiplexer.rb b/lib/dispatch-rider/demultiplexer.rb index e412ae4..e83276d 100644 --- a/lib/dispatch-rider/demultiplexer.rb +++ b/lib/dispatch-rider/demultiplexer.rb @@ -22,8 +22,8 @@ def start sleep 1 handle_next_queue_item - rescue => exception - error_handler.call(Message.new(subject: "TopLevelError", body: {}), exception) + rescue => e + error_handler.call(Message.new(subject: "TopLevelError", body: {}), e) throw :done end @@ -49,8 +49,8 @@ def dispatch_message(message) with_current_message(message) do dispatcher.dispatch(message) end - rescue => exception - handle_message_error message, exception + rescue => e + handle_message_error message, e false end @@ -75,9 +75,9 @@ def handle_next_queue_item def handle_message_error(message, exception) error_handler.call(message, exception) - rescue => error_handler_exception # the error handler crashed - Logging::LifecycleLogger.log_error_handler_fail message, error_handler_exception - raise error_handler_exception + rescue => e # the error handler crashed + Logging::LifecycleLogger.log_error_handler_fail message, e + raise e end def logger diff --git a/lib/dispatch-rider/logging/lifecycle_logger.rb b/lib/dispatch-rider/logging/lifecycle_logger.rb index 5b477a5..ee34e68 100644 --- a/lib/dispatch-rider/logging/lifecycle_logger.rb +++ b/lib/dispatch-rider/logging/lifecycle_logger.rb @@ -17,9 +17,9 @@ def wrap_handling(message) log_start(message) yield log_success(message) - rescue => exception - log_fail(message, exception) - raise exception + rescue => e + log_fail(message, e) + raise e ensure log_complete(message, Time.now - start_time) end