module Trusty::Errors::ExceptionHandlers

Public Instance Methods

notify_exception(exception, options = {}) click to toggle source

include in classes

# File lib/trusty/errors/exception_handlers.rb, line 16
def notify_exception(exception, options = {})
  
  options[:env] ||= respond_to?(:request) ? request.env : respond_to?(:env) ? env : nil
  
  ActiveSupport::Notifications.publish("trusty.errors.notify_exception", exception, options)
  
  raise exception if options[:raise] == true
end
try_with_data(data) { || ... } click to toggle source
# File lib/trusty/errors/exception_handlers.rb, line 7
def try_with_data(data, &block)
  begin
    yield
  rescue => exception
    notify_exception exception, :data => data, :raise => true
  end
end