From 594799447993c3158878c4f7b3f197adaa9431b1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 9 Jan 2015 06:53:00 +0100 Subject: [PATCH] Fix error handling for local files in :adblock-update --- qutebrowser/browser/adblock.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/adblock.py b/qutebrowser/browser/adblock.py index c70a3ec93..3784a122b 100644 --- a/qutebrowser/browser/adblock.py +++ b/qutebrowser/browser/adblock.py @@ -112,7 +112,7 @@ class HostBlocker: "Run :adblock-update to get adblock lists.") @cmdutils.register(instance='host-blocker') - def adblock_update(self): + def adblock_update(self, win_id: {'special': 'win_id'}): """Update the adblock block lists.""" self.blocked_hosts = set() self._done_count = 0 @@ -125,8 +125,10 @@ class HostBlocker: if url.scheme() == 'file': try: fileobj = open(url.path(), 'rb') - except OSError: - log.misc.exception("Failed to open block list!") + except OSError as e: + message.error(win_id, "adblock: Error while reading {}: " + "{}".format(url.path(), e.strerror)) + continue download = FakeDownload(fileobj) self._in_progress.append(download) self.on_download_finished(download)