Sha256: 303c6a8c67594ead11350dc8ecd9da0b9bea58d39fd72cdbe6cb60d85aaeb9fe

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

module ErrornotNotifier
  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_errornot, :rescue_action_locally)
        base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_errornot)
      end

      private

      def rescue_action_locally_with_errornot(exception)
        result = rescue_action_locally_without_errornot(exception)

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

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

        result
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
errornot_notifier-1.1.1 lib/errornot_notifier/rails/error_lookup.rb
errornot_notifier-1.1.0 lib/errornot_notifier/rails/error_lookup.rb
errornot_notifier-1.0.2 lib/errornot_notifier/rails/error_lookup.rb
errornot_notifier-1.0.1 lib/errornot_notifier/rails/error_lookup.rb
errornot_notifier-1.0.0 lib/errornot_notifier/rails/error_lookup.rb