Module: HttpApiClient::Errors::Factory

Included in:
Client
Defined in:
lib/http_api_client/errors.rb

Instance Method Summary collapse

Instance Method Details

#error_for_status(status) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/http_api_client/errors.rb', line 53

def error_for_status(status)
  case status
  when 400
    BadRequest
  when 401
    Unauthorized
  when 403
    Forbidden
  when 404
    NotFound
  when 405
    MethodNotAllowed
  when 406
    NotAcceptable
  when 408
    RequestTimeout

  when 422
    UnprocessableEntity

  when 429
    TooManyRequests

  when 500
    InternalServerError
  when 501
    NotImplemented
  when 502
    BadGateway
  when 503
    ServiceUnavailable
  when 504
     GatewayTimeout

  else
    UnknownStatus
  end
end