Sha256: c200c78390eb03a0e5619746cb2c0f8e9001fa305fcf332e48b97fc837af2c86

Contents?: true

Size: 876 Bytes

Versions: 4

Compression:

Stored size: 876 Bytes

Contents

class Bullhorn
  module Plugin
    class << self
      attr_accessor :options

      attr :ignored_exceptions
    end

    def self.ignored_exceptions
      [].tap do |ex|
        ex << ActiveRecord::RecordNotFound if defined? ActiveRecord
        if defined? ActionController
          ex << ActionController::UnknownController
          ex << ActionController::UnknownAction
          ex << ActionController::RoutingError if ActionController.const_defined?(:RoutingError)
        end
      end
    end

  protected
    def rescue_action_in_public(exception)
      notify_with_bullhorn!(exception)

      super
    end

    def notify_with_bullhorn!(exception)
      unless Bullhorn::Plugin.ignored_exceptions.include?(exception.class)
        bullhorn = Bullhorn.new(self, Bullhorn::Plugin.options)
        bullhorn.notify(exception, request.env)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bullhorn-0.1.0 lib/bullhorn/plugin.rb
bullhorn-0.0.6 lib/bullhorn/plugin.rb
bullhorn-0.0.4 lib/bullhorn/plugin.rb
bullhorn-0.0.3 lib/bullhorn/plugin.rb