Sha256: e47249a6790da99d891916b535057d30dd2099da00a1c7780753109ce9231ae3

Contents?: true

Size: 1.15 KB

Versions: 27

Compression:

Stored size: 1.15 KB

Contents

module Airbrake
  module Rails
    module ErrorLookup

      # Sets up an alias chain to catch exceptions when Rails does
      def self.included(base) #:nodoc:
        if base.method_defined?(:rescue_action_locally)
          base.send(:alias_method, :rescue_action_locally_without_airbrake, :rescue_action_locally)
          base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_airbrake)
        end
      end

      private

      def rescue_action_locally_with_airbrake(exception)
        result = rescue_action_locally_without_airbrake(exception)

        if Airbrake.configuration.development_lookup
          path   = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'rescue.erb')
          notice = Airbrake.build_lookup_hash_for(exception, airbrake_request_data)

          result << @template.render(
            :file          => path,
            :use_full_path => false,
            :locals        => { :host    => Airbrake.configuration.host,
                                :api_key => Airbrake.configuration.api_key,
                                :notice  => notice })
        end

        result
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
airbrake-3.1.13 lib/airbrake/rails/error_lookup.rb
airbrake-3.1.12 lib/airbrake/rails/error_lookup.rb
airbrake-3.1.11 lib/airbrake/rails/error_lookup.rb
airbrake-3.1.10 lib/airbrake/rails/error_lookup.rb
airbrake-3.1.9 lib/airbrake/rails/error_lookup.rb
airbrake-3.1.8 lib/airbrake/rails/error_lookup.rb
airbrake-3.1.7 lib/airbrake/rails/error_lookup.rb