Sha256: f960818f86c72fbab3a8b2aebe80e7c6df89d32fdbb2e586626c42d8d7e11c33

Contents?: true

Size: 626 Bytes

Versions: 6

Compression:

Stored size: 626 Bytes

Contents

module Nesty
  module NestedError
    attr_reader :nested, :raw_backtrace

    def initialize(msg = nil, nested)
      super(msg)
      @nested = nested
    end

    def set_backtrace(backtrace)
      @raw_backtrace = backtrace
      if nested
        backtrace = backtrace - nested_raw_backtrace
        backtrace += ["#{nested.backtrace.first}: #{nested.message} (#{nested.class.name})"]
        backtrace += nested.backtrace[1..-1] || []
      end
      super(backtrace)
    end

    private

    def nested_raw_backtrace
      nested.respond_to?(:raw_backtrace) ? nested.raw_backtrace : nested.backtrace
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
message-driver-0.3.0 lib/message_driver/vendor/nesty/nested_error.rb
message-driver-0.2.2 lib/message_driver/vendor/nesty/nested_error.rb
message-driver-0.2.1 lib/message_driver/vendor/nesty/nested_error.rb
message-driver-0.2.0 lib/message_driver/vendor/nesty/nested_error.rb
message-driver-0.2.0.rc2 lib/message_driver/vendor/nesty/nested_error.rb
message-driver-0.2.0.rc1 lib/message_driver/vendor/nesty/nested_error.rb