class Brightpearl::RequestError

Attributes

code[R]
response[R]
status[R]

Public Class Methods

new(msg, response: nil, status: nil) click to toggle source
Calls superclass method
# File lib/brightpearl/errors.rb, line 4
def initialize(msg, response: nil, status: nil)
  if response["errors"] && response["errors"].size == 1 # If error is easily identifiable then set it as the Error message
    error = response["errors"][0]["message"]
    @code = response["errors"][0]["code"]
    super(error)
  else
    super(msg)
  end
  @response = response
  @status = status
end