From: Huang Hao Date: Thu, 28 Feb 2013 03:37:19 +0000 (+0800) Subject: Keep error info from exception URLGrabError. X-Git-Tag: 0.18~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7673e6b909d58d0cd87fd80a906bdd438353ec4e;p=tools%2Fmic.git Keep error info from exception URLGrabError. The origianl URLGrabError exception contains useful information describing detail of the error, such as errno and http error code. However in some situation it doesn't include url address. So append it if not appear. Examples of console output before: Error : URLGrabber error: https://xxxx Error : URLGrabber error: https://xxxx We can't find out difference from those two message. After: Error : [Errno 14] HTTP Error 401 : https://xxxx Error : [Errno 14] problem making ssl connection on https://xxxx Change-Id: I3f153e4caf8bbfcbac56ca22118733de7c5a3e66 --- diff --git a/mic/utils/grabber.py b/mic/utils/grabber.py index cf2fe09..45e30b4 100644 --- a/mic/utils/grabber.py +++ b/mic/utils/grabber.py @@ -35,12 +35,19 @@ def myurlgrab(url, filename, proxies, progress_obj = None): else: try: - filename = g.urlgrab(url = str(url), filename = filename, - ssl_verify_host = False, ssl_verify_peer = False, - proxies = proxies, http_headers = (('Pragma', 'no-cache'),), - quote = 0, progress_obj = progress_obj) - except grabber.URLGrabError, e: - raise CreatorError("URLGrabber error: %s" % url) + filename = g.urlgrab(url=str(url), + filename=filename, + ssl_verify_host=False, + ssl_verify_peer=False, + proxies=proxies, + http_headers=(('Pragma', 'no-cache'),), + quote=0, + progress_obj=progress_obj) + except grabber.URLGrabError, err: + msg = str(err) + if msg.find(url) < 0: + msg += ' on %s' % url + raise CreatorError(msg) return filename