From 15ee186499af22e298a22a32fa053e4194f9b41f Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 22 Feb 2009 17:31:06 -0700 Subject: [PATCH] scripts: stop using RuntimeError, for #639 --- src/allmydata/scripts/common_http.py | 2 +- src/allmydata/scripts/tahoe_backup.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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() -- 2.45.2