Module: HomeAway::API::Errors

Defined in:
lib/homeaway/api/errors/ha_api_errors.rb

Overview

a collection of error classes corresponding to various errors that might be raised by the HomeAway API

Defined Under Namespace

Classes: APINotAvailableError, BadRequestError, ClientError, ConflictError, ForbiddenError, HomeAwayAPIError, ImATeapotError, InternalServerError, MethodNotAllowedError, NotAcceptableError, RequestedRangeNotSatisfiableError, ResourceNotFoundError, TokenExpiredError, TooManyRequestsError, UnauthorizedError

Class Method Summary collapse

Class Method Details

.for_http_code(status_code) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/homeaway/api/errors/ha_api_errors.rb', line 129

def self.for_http_code(status_code)
  begin
    self.const_get(self.constants.select do |c|
      const = self.const_get c
      Class === const &&
          const.const_defined?(:CODE) &&
          const.const_get(:CODE) == status_code.to_i
    end.first)
  rescue => _
    HomeAwayAPIError
  end
end