Exception: Escort::BaseError

Inherits:
StandardError
  • Object
show all
Includes:
Error
Defined in:
lib/escort/error/error.rb

Overview

all our exceptions will supported nesting other exceptions also all our exception will be a kind_of? Escort::Error

Direct Known Subclasses

ClientError, InternalError, TransientError, UserError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, original = $!) ⇒ BaseError

Returns a new instance of BaseError


17
18
19
20
# File 'lib/escort/error/error.rb', line 17

def initialize(msg, original=$!)
  super(msg)
  @original = original
end

Instance Attribute Details

#originalObject (readonly)

Returns the value of attribute original


15
16
17
# File 'lib/escort/error/error.rb', line 15

def original
  @original
end

Instance Method Details

#set_backtrace(bt) ⇒ Object


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/escort/error/error.rb', line 22

def set_backtrace(bt)
  if original
    original.backtrace.reverse.each do |line|
      bt.last == line ? bt.pop : break
    end
    original_first = original.backtrace.shift
    bt.concat ["#{original_first}: #{original.message}"]
    bt.concat original.backtrace
  end
  super(bt)
end