Module: Abt::HttpError

Defined in:
lib/abt/http_error.rb

Defined Under Namespace

Classes: BadRequestError, ForbiddenError, HttpError, InternalServerError, MethodNotAllowedError, NotFoundError, NotImplementedError, ProcessingError, TooManyRequestsError, UnauthorizedError, UnknownError, UnsupportedMediaTypeError

Class Method Summary collapse

Class Method Details

.error_class_for_status(status) ⇒ Object

rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/abt/http_error.rb', line 29

def self.error_class_for_status(status) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
  case status
  when 400 then BadRequestError
  when 401 then UnauthorizedError
  when 403 then ForbiddenError
  when 404 then NotFoundError
  when 405 then MethodNotAllowedError
  when 415 then UnsupportedMediaTypeError
  when 422 then ProcessingError
  when 429 then TooManyRequestsError
  when 500 then InternalServerError
  when 501 then NotImplementedError
  else UnknownError
  end
end