Sha256: efa85b078bba6a2f59528f49b87dbe61c441c5b6d678fbaafd60d155008e43a7

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 Bytes

Contents

module CoderWally
  # Raises errors from the service request
  class ExceptionHandler
    # Initialize with the error object
    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
  end
end
# Handles user not found exception
class UserNotFoundError < StandardError
end

# Handles server exception
class ServerError < StandardError
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coder_wally-1.0.2 lib/coder_wally/exception_handler.rb
coder_wally-1.0.1 lib/coder_wally/exception_handler.rb
coder_wally-1.0.0 lib/coder_wally/exception_handler.rb
coder_wally-0.1.2 lib/coder_wally/exception_handler.rb