From 4dcac5bed5c0c90fb303c4eb3a4c306b9e6d932a Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 9 Oct 2024 10:14:08 +0200 Subject: [PATCH] Add and apply Naming/RescuedExceptionsVariableName rubocop rule This rule was introduced in RuboCop 0.67.2, but now after seeing a fix in version 1.65.1, we have decided to add it. The reason for adding it is to ensure consistency in how we reference exceptions throughout the project, by following a standard naming convention for exception variables. --- .rubocop.yml | 3 +++ app/models/machine_learning.rb | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index adea1e858..e36c33623 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -337,6 +337,9 @@ Naming/BlockForwarding: - "app/controllers/management/base_controller.rb" - "app/controllers/subscriptions_controller.rb" +Naming/RescuedExceptionsVariableName: + Enabled: true + Naming/VariableName: Enabled: true diff --git a/app/models/machine_learning.rb b/app/models/machine_learning.rb index f7bb3503e..5541d3327 100644 --- a/app/models/machine_learning.rb +++ b/app/models/machine_learning.rb @@ -62,9 +62,9 @@ class MachineLearning job.update!(finished_at: Time.current) Mailer.machine_learning_success(user).deliver_later - rescue Exception => error - handle_error(error) - raise error + rescue Exception => e + handle_error(e) + raise e end end handle_asynchronously :run, queue: "machine_learning"