lib/qs/error_handler.rb in qs-0.7.0 vs lib/qs/error_handler.rb in qs-0.7.1
- old
+ new
@@ -1,11 +1,17 @@
+require 'dat-worker-pool/worker'
require 'qs/queue'
module Qs
class ErrorHandler
+ # these are standard error classes that we rescue and run through any
+ # configured error procs; use the same standard error classes that
+ # dat-worker-pool rescues
+ STANDARD_ERROR_CLASSES = DatWorkerPool::Worker::STANDARD_ERROR_CLASSES
+
attr_reader :exception, :context, :error_procs
def initialize(exception, context_hash)
@exception = exception
@context = ErrorContext.new(context_hash)
@@ -19,10 +25,10 @@
# exception that occurred.
def run
@error_procs.each do |error_proc|
begin
error_proc.call(@exception, @context)
- rescue StandardError => proc_exception
+ rescue *STANDARD_ERROR_CLASSES => proc_exception
@exception = proc_exception
end
end
end