Module: Minfraud::ErrorHandler
- Defined in:
- lib/minfraud/error_handler.rb
Overview
ErrorHandler provides a method to raise exceptions on errors.
Class Method Summary collapse
-
.examine(response) ⇒ Minfraud::HTTPService::Response
Return the response if the HTTP status code is 2xx.
Class Method Details
.examine(response) ⇒ Minfraud::HTTPService::Response
Return the response if the HTTP status code is 2xx. Otherwise raise an error.
22 23 24 25 26 |
# File 'lib/minfraud/error_handler.rb', line 22 def examine(response) return response if response.status > 199 && response.status < 300 raise(*STATUS_CODES.fetch(response.code, [ServerError, 'Server error'])) end |