mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 23:02:25 +00:00
scripts: stop using RuntimeError, for #639
This commit is contained in:
parent
c23d051d3f
commit
15ee186499
@ -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"
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user