WebBrowser/SafeBrowsing/SafeBrowsingDialog.py

changeset 6234
fb1f9e681848
parent 6233
a64b986abb54
child 6645
ad476851d7e0
diff -r a64b986abb54 -r fb1f9e681848 WebBrowser/SafeBrowsing/SafeBrowsingDialog.py
--- a/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py	Wed Apr 11 19:57:23 2018 +0200
+++ b/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py	Thu Apr 12 19:12:36 2018 +0200
@@ -293,24 +293,31 @@
         #
         urlStr = self.urlEdit.text()
         url = QUrl.fromUserInput(urlStr)
-        threatLists = self.__manager.lookupUrl(url)
-        # TODO: handle threatLists being None (indicating a lookup error)
+        threatLists, error = self.__manager.lookupUrl(url)
         
-        if threatLists:
+        if error:
+            E5MessageBox.warning(
+                self,
+                self.tr("Check URL"),
+                self.tr("<p>The Google Safe Browsing Server reported an"
+                        " error.</p><p>{0}</p>").format(error)
+            )
+        elif threatLists:
             threatMessages = self.__manager.getThreatMessages(threatLists)
             E5MessageBox.warning(
                 self,
                 self.tr("Check URL"),
-                self.tr("<p>The URL <b>{0}</b> was found in the Safe Browsing"
-                        " Database.</p>{1}").format(urlStr,
-                                                    "".join(threatMessages))
+                self.tr("<p>The URL <b>{0}</b> was found in the Safe"
+                        " Browsing Database.</p>{1}").format(
+                    urlStr, "".join(threatMessages))
             )
         else:
             E5MessageBox.information(
                 self,
                 self.tr("Check URL"),
                 self.tr("<p>The URL <b>{0}</b> was not found in the Safe"
-                        " Browsing Database and may be considered safe.</p>")
+                        " Browsing Database and may be considered safe."
+                        "</p>")
                 .format(urlStr)
             )
     

eric ide

mercurial