Module: RewardStation::NestingError

Included in:
ConnectionError
Defined in:
lib/reward_station/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#causeObject (readonly)

Returns the value of attribute cause.



4
5
6
# File 'lib/reward_station/errors.rb', line 4

def cause
  @cause
end

Instance Method Details

#initialize(message = nil, cause = $!) ⇒ Object



6
7
8
9
# File 'lib/reward_station/errors.rb', line 6

def initialize message = nil, cause = $!
  @cause = cause
  super(message || cause && cause.message)
end

#set_backtrace(bt) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/reward_station/errors.rb', line 11

def set_backtrace bt
  if cause
    cause.backtrace.reverse.each do |line|
      bt.last == line ? bt.pop : break
    end
    bt << "cause: #{cause.class.name}: #{cause}"
    bt.concat cause.backtrace
  end
  super bt
end