Module: SmoothOperator::Exceptions
Defined Under Namespace
Classes: AuthorizationRequired, Base, EntityNotProcessed, NotFound, ServerError, Unknown
Constant Summary collapse
- CODES_TO_IGNORE =
[200]
- CODE_VS_EXCEPTIONS =
{ 401 => AuthorizationRequired, 422 => EntityNotProcessed, 404 => NotFound, 500 => ServerError }
Instance Method Summary collapse
Instance Method Details
#raise_proper_exception(response) ⇒ Object
6 7 8 9 10 |
# File 'lib/smooth_operator/exceptions.rb', line 6 def raise_proper_exception(response) return nil if CODES_TO_IGNORE.include?(response.code) exception_to_raise = (CODE_VS_EXCEPTIONS[response.code] || SmoothOperator::Exceptions::Unknown).new(response) raise exception_to_raise, exception_to_raise. end |