From 405a8ce77bbd2e46ca092610d46bb0d55c61a630 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 9 Jan 2018 17:47:43 +0100 Subject: [PATCH] Improved handling of non StandardError exceptions in Scheduler Threads for better debugging, reasoning and error handling of Scheduler threads. --- app/models/scheduler.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index 8397032fd..dd0520675 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -209,6 +209,13 @@ class Scheduler < ApplicationModel active: false, ) end + + # rescue any other Exceptions that are not StandardError or childs of it + # https://stackoverflow.com/questions/10048173/why-is-it-bad-style-to-rescue-exception-e-in-ruby + # http://rubylearning.com/satishtalim/ruby_exceptions.html + rescue Exception => e # rubocop:disable Lint/RescueException + logger.error "execute #{job.method} (try_count #{try_count}) exited with a non standard-error #{e.inspect}" + raise end def self.worker(foreground = false)