Exception: Stockboy::TranslationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/stockboy/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, record) ⇒ TranslationError

Returns a new instance of TranslationError.



6
7
8
9
10
# File 'lib/stockboy/exceptions.rb', line 6

def initialize (key, record)
  @key = key
  @record = record
  @cause = $!
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



21
22
23
# File 'lib/stockboy/exceptions.rb', line 21

def key
  @key
end

#recordObject (readonly)

Returns the value of attribute record.



22
23
24
# File 'lib/stockboy/exceptions.rb', line 22

def record
  @record
end

Instance Method Details

#backtraceObject



17
18
19
# File 'lib/stockboy/exceptions.rb', line 17

def backtrace
  @cause && @cause.backtrace || super
end

#messageObject



12
13
14
15
# File 'lib/stockboy/exceptions.rb', line 12

def message
  reason = @cause && @cause.message || super
  "Attribute [#{key}] caused #{reason}"
end