From: Brian Warner Date: Mon, 23 Feb 2009 00:31:06 +0000 (-0700) Subject: scripts: stop using RuntimeError, for #639 X-Git-Tag: allmydata-tahoe-1.4.0~139 X-Git-Url: https://git.rkrishnan.org/frontends/FTP-and-SFTP.txt?a=commitdiff_plain;h=15ee186499af22e298a22a32fa053e4194f9b41f;p=tahoe-lafs%2Ftahoe-lafs.git scripts: stop using RuntimeError, for #639 --- diff --git a/src/allmydata/scripts/common_http.py b/src/allmydata/scripts/common_http.py index dda3a920..c62dfaec 100644 --- a/src/allmydata/scripts/common_http.py +++ b/src/allmydata/scripts/common_http.py @@ -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" diff --git a/src/allmydata/scripts/tahoe_backup.py b/src/allmydata/scripts/tahoe_backup.py index 55e07fc0..f75aafaf 100644 --- a/src/allmydata/scripts/tahoe_backup.py +++ b/src/allmydata/scripts/tahoe_backup.py @@ -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()