Exception: Veritable::VeritableError

Inherits:
StandardError
  • Object
show all
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 or row, dynamically defined at initialization.

Instance Attribute Summary collapse

Instance Method Summary collapse

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(message, opts=nil)
  super(message)
  @message = 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

#messageObject (readonly)

Accessor for the error message



10
11
12
# File 'lib/veritable/errors.rb', line 10

def message
  @message
end

Instance Method Details

#inspectObject

Prints the error message



43
# File 'lib/veritable/errors.rb', line 43

def inspect; message; end

#to_sObject

Prints the error message



40
# File 'lib/veritable/errors.rb', line 40

def to_s; message; end