if isinstance(body, str):
body = StringIO(body)
elif isinstance(body, unicode):
- raise RuntimeError("do_http body must be a bytestring, not unicode")
+ raise TypeError("do_http body must be a bytestring, not unicode")
else:
# We must give a Content-Length header to twisted.web, otherwise it
# seems to get a zero-length file. I suspect that "chunked-encoding"
from allmydata.util import time_format
from allmydata.scripts import backupdb
+class HTTPError(Exception):
+ pass
+
def raiseHTTPError(msg, resp):
msg = msg + ": %s %s %s" % (resp.status, resp.reason, resp.read())
- raise RuntimeError(msg)
+ raise HTTPError(msg)
def readonly(writedircap):
return uri.from_string_dirnode(writedircap).get_readonly().to_string()