From d4f58533c0f93d423ab83d09f769a86fba88103e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 6 Jun 2017 06:29:44 +0200 Subject: [PATCH] Add error messages for QtWebEngine downloads Fixes #2164 --- CHANGELOG.asciidoc | 2 ++ qutebrowser/browser/webengine/webenginedownloads.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index cded230ea..ccb17816e 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -70,6 +70,8 @@ Changed closes the current tab. - (QtWebEngine) With Qt 5.9, `content -> cookies-store` can now be set without a restart. +- (QtWebEngine) With Qt 5.9, better error messages are now shown for failed + downloads. - The adblocker now also blocks non-GET requests (e.g. POST). - `javascript:` links can now be hinted. - `:view-source`, `:tab-clone` and `:navigate --tab` now don't open the tab as diff --git a/qutebrowser/browser/webengine/webenginedownloads.py b/qutebrowser/browser/webengine/webenginedownloads.py index 7eec132ed..4a558471f 100644 --- a/qutebrowser/browser/webengine/webenginedownloads.py +++ b/qutebrowser/browser/webengine/webenginedownloads.py @@ -77,7 +77,12 @@ class DownloadItem(downloads.AbstractDownloadItem): elif state == QWebEngineDownloadItem.DownloadInterrupted: self.successful = False # https://bugreports.qt.io/browse/QTBUG-56839 - self._die("Download failed") + try: + reason = self._qt_item.interruptReasonString() + except AttributeError: + # Qt < 5.9 + reason = "Download failed" + self._die(reason) else: raise ValueError("_on_state_changed was called with unknown state " "{}".format(state_name))