Module: SmoothOperator::Operator::Exceptions
- Extended by:
- Exceptions
- Included in:
- Exceptions
- Defined in:
- lib/smooth_operator/operator/exceptions.rb
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, code) ⇒ Object
8 9 10 11 12 |
# File 'lib/smooth_operator/operator/exceptions.rb', line 8 def raise_proper_exception(response, code) return nil if CODES_TO_IGNORE.include?(code) exception_to_raise = (CODE_VS_EXCEPTIONS[code] || SmoothOperator::Operator::Exceptions::Unknown).new(response) #raise exception_to_raise, exception_to_raise.message end |