From c3b5bca0e83266f7ece5d2517560e29895e7122a Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 26 Apr 2017 09:32:03 +0800 Subject: [PATCH] Log error for all exceptions in scheduler stats. --- lib/scheduler/manager.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/scheduler/manager.rb b/lib/scheduler/manager.rb index 44317f7cc65..ec8e249e9b3 100644 --- a/lib/scheduler/manager.rb +++ b/lib/scheduler/manager.rb @@ -93,12 +93,12 @@ module Scheduler ) end klass.new.perform - rescue Jobs::HandledExceptionWrapper - # Discourse.handle_exception was already called, and we don't have any extra info to give - failed = true rescue => e - Discourse.handle_job_exception(e, {message: "Running a scheduled job", job: klass}) - error = "#{e.message}: #{e.backtrace.join("\n")}" + if e.class != Jobs::HandledExceptionWrapper + Discourse.handle_job_exception(e, message: "Running a scheduled job", job: klass) + end + + error = "#{e.class}: #{e.message} #{e.backtrace.join("\n")}" failed = true end duration = ((Time.now.to_f - start) * 1000).to_i