Sha256: 2a58b474fbec1fa94aea5263093a87ed504c412c64a107ccb2da655e8df24518

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 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)
        bullhorn = Bullhorn.new(self, Bullhorn::Plugin.options)
        bullhorn.notify(exception, request.env)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bullhorn-0.0.2 lib/bullhorn/plugin.rb
bullhorn-0.0.1 lib/bullhorn/plugin.rb