scripts: stop using RuntimeError, for #639

This commit is contained in:
Brian Warner 2009-02-22 17:31:06 -07:00
parent c23d051d3f
commit 15ee186499
2 changed files with 5 additions and 2 deletions

View File

@ -27,7 +27,7 @@ def do_http(method, url, body=""):
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"

View File

@ -9,9 +9,12 @@ from allmydata import uri
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()