Module: Notifications::Client::ErrorHandling
- Included in:
- Speaker
- Defined in:
- lib/notifications/client/request_error.rb
Instance Method Summary collapse
Instance Method Details
#build_error(response) ⇒ Object
38 39 40 |
# File 'lib/notifications/client/request_error.rb', line 38 def build_error(response) error_class_for_code(response.code.to_i).new(response) end |
#error_class_for_code(code) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/notifications/client/request_error.rb', line 42 def error_class_for_code(code) case code when 400 BadRequestError when 403 AuthError when 404 NotFoundError when 429 RateLimitError when (400..499) ClientError when (500..599) ServerError else RequestError end end |