Sha256: b7886d6cd08ac6a6af5db06b2e1d46bcb25310099e34be0c9857380de394dc78

Contents?: true

Size: 1011 Bytes

Versions: 10

Compression:

Stored size: 1011 Bytes

Contents

module Honeybadger
  module ExceptionExtensions
    module Bindings
      def self.included(base)
        base.send(:alias_method, :set_backtrace_without_honeybadger, :set_backtrace)
        base.send(:alias_method, :set_backtrace, :set_backtrace_with_honeybadger)
      end

      def set_backtrace_with_honeybadger(*args, &block)
        if caller.none? { |loc| loc.match(Honeybadger::Backtrace::Line::INPUT_FORMAT) && Regexp.last_match(1) == __FILE__ }
          @__honeybadger_bindings_stack = binding.callers.drop(1)
        end

        set_backtrace_without_honeybadger(*args, &block)
      end

      def __honeybadger_bindings_stack
        @__honeybadger_bindings_stack || []
      end
    end

    module NullBindings
      def __honeybadger_bindings_stack
        []
      end
    end
  end
end

begin
  require 'binding_of_caller'
  Exception.send(:include, Honeybadger::ExceptionExtensions::Bindings)
rescue LoadError
  Exception.send(:include, Honeybadger::ExceptionExtensions::NullBindings)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
honeybadger-1.16.2 lib/honeybadger/exception_extensions.rb
honeybadger-1.16.1 lib/honeybadger/exception_extensions.rb
honeybadger-1.16.0 lib/honeybadger/exception_extensions.rb
honeybadger-1.15.3 lib/honeybadger/exception_extensions.rb
honeybadger-1.15.2 lib/honeybadger/exception_extensions.rb
honeybadger-1.15.1 lib/honeybadger/exception_extensions.rb
honeybadger-1.15.0 lib/honeybadger/exception_extensions.rb
honeybadger-1.14.0 lib/honeybadger/exception_extensions.rb
honeybadger-1.12.0.beta3 lib/honeybadger/exception_extensions.rb
honeybadger-1.12.0.beta2 lib/honeybadger/exception_extensions.rb