Sha256: edb42c83c807229d3e86d90528b31da1aacd974423e509d74d39bf0f891baaa3

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

module Pulse
  module Rails
    module ErrorLookup

      # Sets up an alias chain to catch exceptions when Rails does
      def self.included(base) #:nodoc:
        base.send(:alias_method, :rescue_action_locally_without_pulse, :rescue_action_locally)
        base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_pulse)
      end

      private

      def rescue_action_locally_with_pulse(exception)
        result = rescue_action_locally_without_pulse(exception)

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

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

        result
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
projectlocker_pulse-1.0.0 lib/pulse/rails/error_lookup.rb
projectlocker_pulse-0.2.1 lib/pulse/rails/error_lookup.rb