Exception: TwelvedataRuby::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/twelvedata_ruby/error.rb

Direct Known Subclasses

EndpointError, ResponseError

Constant Summary collapse

DEFAULT_MSGS =
{
  "EndpointError" => "Endpoint is not valid. %{invalid}",
  "EndpointNameError" => "`%{invalid}` is not a correct endpoint. Valid values are: `%{valid_names}`",
  "EndpointParametersKeysError" => "Invalid parameters found: `%{invalid}`. Valid parameters for `%{name}` "\
                                   "endpoint are: `%{parameters}`. Please see: `Twelvedata::Endpoint#parameters` for more details",
  "EndpointRequiredParametersError" => "Missing values for required parameters: `%{invalid}`. "\
                                       "`%{name}` endpoint required parameters are: `%{required}`.",
  "ResponseError" => "Encountered an error from the response"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Error

Returns a new instance of Error.



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

def initialize(args={})
  @attrs = args[:attrs] || {}
  super((args[:message] || DEFAULT_MSGS[Utils.demodulize(self.class)]) % @attrs)
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



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

def attrs
  @attrs
end