Sha256: 119d32da0559b2ff28d6553f2f50a353f0d01584843e47026306f5705aa41b89
Contents?: true
Size: 952 Bytes
Versions: 4
Compression:
Stored size: 952 Bytes
Contents
module Brightpearl class RequestError < StandardError attr_reader :response, :code, :status 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 puts @code puts error @response = response @status = status end end class Throttled < StandardError attr_reader :response, :code, :status def initialize(msg, response: nil, status: nil) super(msg) @response = response @status = status end end class InvalidToken < StandardError attr_reader :response, :status def initialize(msg, response: nil, status: nil) super(msg) @response = response @status = status end end end
Version data entries
4 entries across 4 versions & 1 rubygems