def raise_error(result)
      raise unless result.is_a? HTTP::Message

      err   = JSON.parse(result.body)
      klass = MantaClient.const_get err['code']
      raise klass, err['message']
    rescue NameError, TypeError, JSON::ParserError
      raise UnknownError, result.status.to_s + ': ' + result.body
    end
def raise_error(result)
      raise unless result.is_a? HTTP::Message

      err   = JSON.parse(result.body)
      klass = MantaClient.const_get err['code']
      raise klass, err['message']
    rescue NameError, TypeError, JSON::ParserError
      raise UnknownError, result.status.to_s + ': ' + result.body
    end
Raises an appropriate exception given the HTTP response. If a 40* is
 returned, attempts to look up an appropriate error class and raise,
 otherwise raises an UnknownError.