Exception: Veritable::VeritableError
- Inherits:
-
StandardError
- Object
- StandardError
- Veritable::VeritableError
- Defined in:
- lib/veritable/errors.rb
Overview
Class for all errors returned by veritable-ruby
Attributes
-
message
– the String message describing the error -
dynamically defined – errors may have other attributes, such as
http_code
orrow
, dynamically defined at initialization.
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Accessor for the error message.
Instance Method Summary collapse
-
#initialize(message, opts = nil) ⇒ VeritableError
constructor
Initializes a Veritable::VeritableError.
-
#inspect ⇒ Object
Prints the error message.
-
#to_s ⇒ Object
Prints the error message.
Constructor Details
#initialize(message, opts = nil) ⇒ VeritableError
Initializes a Veritable::VeritableError
Users should not invoke directly.
Arguments
message
– a String message describing the error opts
– a Hash optionally specifying other instance attributes to be dynamically defined
See also: dev.priorknowledge.com/docs/client/ruby
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/veritable/errors.rb', line 22 def initialize(, opts=nil) super() @message = if opts.is_a? Hash @opts = opts eigenclass = class << self; self; end @opts.keys.each {|k| eigenclass.send(:define_method, k.to_sym) { @opts[k] } } if @opts.include? 'inner_error' set_backtrace(@opts['inner_error'].backtrace) end end end |
Instance Attribute Details
#message ⇒ Object (readonly)
Accessor for the error message
10 11 12 |
# File 'lib/veritable/errors.rb', line 10 def @message end |
Instance Method Details
#inspect ⇒ Object
Prints the error message
43 |
# File 'lib/veritable/errors.rb', line 43 def inspect; ; end |
#to_s ⇒ Object
Prints the error message
40 |
# File 'lib/veritable/errors.rb', line 40 def to_s; ; end |