Sha256: a2067c664e9ff2a387a2e876fabec67729191000fb35a8a48179f905d09fc4f3
Contents?: true
Size: 740 Bytes
Versions: 10
Compression:
Stored size: 740 Bytes
Contents
module CronoTrigger class GlobalExceptionHandler def self.handle_global_exception(ex) new.handle_global_exception(ex) end def handle_global_exception(ex) handlers = CronoTrigger.config.global_error_handlers handlers.each do |callable| callable, arity = ensure_callable(callable) args = [ex] args = arity < 0 ? args : args.take(arity) callable.call(*args) end rescue Exception => e ActiveRecord::Base.logger.error("CronoTrigger error handler raises error") ActiveRecord::Base.logger.error(e) end private def ensure_callable(callable) if callable.respond_to?(:call) return callable, callable.arity end end end end
Version data entries
10 entries across 10 versions & 1 rubygems