Improve an error message to be more explicit.
Make an error message about a bad URL include the URL in question. Also clean
up an exception definition oddity flagged by the linter.
BUG=None
TEST=Saw improved error message after the change, image_to_live.sh.
Change-Id: Ie7df9126c174ceedf2ed296fa22ea4c03d75b1cc
Reviewed-on: https://chromium-review.googlesource.com/167734
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
diff --git a/devserver.py b/devserver.py
index ded50ba..4b32269 100755
--- a/devserver.py
+++ b/devserver.py
@@ -91,18 +91,17 @@
class DevServerError(Exception):
"""Exception class used by this module."""
- pass
-class DevServerHTTPError(Exception):
+class DevServerHTTPError(cherrypy.HTTPError):
"""Exception class to log the HTTPResponse before routing it to cherrypy."""
def __init__(self, status, message):
"""
@param status: HTTPResponse status.
@param message: Message associated with the response.
"""
+ cherrypy.HTTPError.__init__(self, status, message)
_Log('HTTPError status: %s message: %s', status, message)
- raise cherrypy.HTTPError(status, message)
def _LeadingWhiteSpaceCount(string):
@@ -409,7 +408,8 @@
"""
if archive_url:
if not archive_url.startswith('gs://'):
- raise DevServerError("Archive URL isn't from Google Storage.")
+ raise DevServerError("Archive URL isn't from Google Storage (%s) ." %
+ archive_url)
return archive_url.rstrip('/')
else: