class RouteNGNClient::RouteNGNResponseMiddleware

Constants

ERROR_STATUSES

Public Instance Methods

on_complete(env) click to toggle source
# File lib/routengn_client/middleware/routengn_response_middleware.rb, line 7
def on_complete(env)
  case env[:status]
  when 401
    raise PermissionDeniedException
  when 404        
    raise NonExistentRecord
  when 0
    raise UnexpectedHTTPException, "recieved an unexpected HTTP response code #{env[:status]}"
  when ERROR_STATUSES
    raise UnexpectedHTTPException, "recieved an unexpected HTTP response code #{env[:status]}"
  end

  env
end