class HasOffersV3::APIError

Any error emitted at business logic level of the HasOffersV3 API that is not fatal but tells that a particular operation cannot be performed.

Public Class Methods

from_response(response) click to toggle source
# File lib/hasoffersv3/api_error.rb, line 8
def from_response(response)
  error_class_chain.each do |error_class|
    err_msg = error_class.detect(response)
    break error_class.new(err_msg, response) if err_msg
  end
end

Protected Class Methods

error_class_chain() click to toggle source
# File lib/hasoffersv3/api_error.rb, line 17
def error_class_chain
  # the order is important, more "blocker-like" errors go before "lax" ones; don't forget to add any new error classes to this chain
  @error_class_chain ||= [IPNotWhitelistedError, MissingParamError, FieldError, InternalError, UnknownError]
end