class Qs::ErrorHandler
Constants
- STANDARD_ERROR_CLASSES
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
Attributes
context[R]
error_procs[R]
exception[R]
Public Class Methods
new(exception, context_hash)
click to toggle source
# File lib/qs/error_handler.rb, line 15 def initialize(exception, context_hash) @exception = exception @context = ErrorContext.new(context_hash) @error_procs = context_hash[:daemon_data].error_procs.reverse end
Public Instance Methods
run()
click to toggle source
The exception that we are handling can change in the case that the configured error proc raises an exception. If this occurs, the new exception will be passed to subsequent error procs. This is designed to avoid “hidden” errors, this way the daemon will log based on the last exception that occurred.
# File lib/qs/error_handler.rb, line 26 def run @error_procs.each do |error_proc| begin error_proc.call(@exception, @context) rescue *STANDARD_ERROR_CLASSES => proc_exception @exception = proc_exception end end end