def error_manager(uri, response)
      case response
      when Net::HTTPSuccess then
        # This covers cases where the response may not validate as JSON.
        begin
          data = JSON.parse(response.body)
        rescue
          data = {}
        end
        ## Get the Headers out of the response object
        data['headers'] = response.to_hash()
        return data
      when Net::HTTPBadRequest
        raise Ropenstack::MalformedRequestError, response.body
      when Net::HTTPNotFound
        raise Ropenstack::NotFoundError, "URI: #{uri} \n" + response.body	
      when Net::HTTPUnauthorized
        raise Ropenstack::UnauthorisedError, response.body
      else
        raise Ropenstack::RopenstackError, response.body
      end
    end
def error_manager(uri, response)
      case response
      when Net::HTTPSuccess then
        # This covers cases where the response may not validate as JSON.
        begin
          data = JSON.parse(response.body)
        rescue
          data = {}
        end
        ## Get the Headers out of the response object
        data['headers'] = response.to_hash()
        return data
      when Net::HTTPBadRequest
        raise Ropenstack::MalformedRequestError, response.body
      when Net::HTTPNotFound
        raise Ropenstack::NotFoundError, "URI: #{uri} \n" + response.body	
      when Net::HTTPUnauthorized
        raise Ropenstack::UnauthorisedError, response.body
      else
        raise Ropenstack::RopenstackError, response.body
      end
    end
All responses from openstack where any errors need to be caught are passed through
 this function. Unless a successful response is passed it will throw a Ropenstack
 error.
 If successful returns a hash of response body, unless response body is nil then it
 returns an empty hash.