From 8517d62b45059fd3634018f078676f75ec4ff205 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sun, 27 Mar 2016 19:14:01 +0200 Subject: [PATCH] Prettier exception handling --- downloader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/downloader.py b/downloader.py index 6395b84..cd74d21 100755 --- a/downloader.py +++ b/downloader.py @@ -40,14 +40,14 @@ def urlparse(url): if "/auswertung/pix/popup.php/" in url: return "http://www.planetromeo.com/img/usr/%s" % url[52:82] else: - raise ValueError("%s is not a valid URL.") + raise ValueError("%s is not a valid URL" % url) def processURL(url, sender = False, geturls = False, verbose = False, shutup = False): verboselog("Processing URL %s..." % url, verbose) try: purl = urlparse(url) - except ValueError: - log("Notice: %s is not a valid URL. Skipping." % url, shutup) + except ValueError as e: + log("Notice: %s. Skipping." % e, shutup) else: if purl == urlparse(url): log("Warning: You may have copied the image URL rather than the link URL from the message window. Use the link URL instead!", shutup)