From 5cbd9ef5da72b37ac06e3fee9767e2d65e604342 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 3 Nov 2015 11:25:46 +0530 Subject: [PATCH] Better error message when URL parsing fails --- src/calibre/ebooks/oeb/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 148eba9d47..1660af59c6 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -410,7 +410,10 @@ def urlnormalize(href): """Convert a URL into normalized form, with all and only URL-unsafe characters URL quoted. """ - parts = urlparse(href) + try: + parts = urlparse(href) + except ValueError as e: + raise ValueError('Failed to parse the URL: %r with underlying error: %s' % (href, as_unicode(e))) if not parts.scheme or parts.scheme == 'file': path, frag = urldefrag(href) parts = ('', '', path, '', '', frag)