From 6f904759b530d5f7934676ad1e45a712e7c7b526 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 20 May 2015 13:24:16 +0200 Subject: [PATCH] urlutils: Fix str() of FuzzyUrlError. --- qutebrowser/utils/urlutils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index e15fa94b5..9cda7c56e 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -379,17 +379,19 @@ class FuzzyUrlError(Exception): """Exception raised by fuzzy_url on problems. Attributes: + msg: The error message to use. url: The QUrl which caused the error. """ def __init__(self, msg, url=None): super().__init__(msg) - if url is not None: - assert not url.isValid() + if url is not None and url.isValid(): + raise ValueError("Got valid URL {}!".format(url.toDisplayString())) self.url = url + self.msg = msg def __str__(self): if self.url is None or not self.url.errorString(): - return str(super()) + return self.msg else: - return '{}: {}'.format(str(super()), self.url.errorString()) + return '{}: {}'.format(self.msg, self.url.errorString())