Class: CoderWally::ExceptionHandler
- Inherits:
-
Object
- Object
- CoderWally::ExceptionHandler
- Defined in:
- lib/coder_wally/exception_handler.rb
Overview
Raises errors from the service request
Instance Method Summary collapse
-
#initialize(error) ⇒ ExceptionHandler
constructor
Initialize with the error object.
Constructor Details
#initialize(error) ⇒ ExceptionHandler
Initialize with the error object
5 6 7 8 9 |
# File 'lib/coder_wally/exception_handler.rb', line 5 def initialize(error) status_code = StatusCodeFromError.new(error).status_code fail ServerError, 'Server error' if status_code == '500' fail UserNotFoundError, 'User not found' if status_code == '404' end |