chiark / gitweb /
fix exception handling in dscanner and update.py
authorMichael Pöhn <michael.poehn@fsfe.org>
Wed, 22 Mar 2017 13:07:54 +0000 (14:07 +0100)
committerMichael Pöhn <michael.poehn@fsfe.org>
Wed, 22 Mar 2017 13:07:54 +0000 (14:07 +0100)
fdroidserver/dscanner.py
fdroidserver/update.py

index 8e224bdb06d6b65273fb2b80837a6ffc736cc5e3..10e98b3177ae0f754c9c7e4ef0a695035b0f2fcf 100644 (file)
@@ -302,7 +302,7 @@ class DockerDriver(object):
                 msg = msg.format(c, t, int(c / t * 100), j)
                 sys.stdout.write(msg)
                 sys.stdout.flush()
-            except:
+            except Exception:
                 pass
         print("\nDONE!\n")
 
index eb92e91b59740c8fd1d4c7c4bf8e89c98c4bb522..7ad41b9abd2da81e8b365e0f52a507466df435d4 100644 (file)
@@ -300,8 +300,8 @@ def update_wiki(apps, sortedids, apks):
                 try:
                     newpage = site.Pages[pagename]
                     newpage.save(text, summary='Auto-created')
-                except:
-                    logging.error("...FAILED to create page '{0}'".format(pagename))
+                except Exception as e:
+                    logging.error("...FAILED to create page '{0}': {1}".format(pagename, e))
 
     # Purge server cache to ensure counts are up to date
     site.pages['Repository Maintenance'].purge()
@@ -925,8 +925,8 @@ def scan_apk(apkcache, apkfilename, repodir, knownapks, use_date_from_apk):
                     f.write(get_icon_bytes(apkzip, iconsrc))
                 apk['icons'][density] = iconfilename
 
-            except:
-                logging.warn("Error retrieving icon file")
+            except Exception as e:
+                logging.warn("Error retrieving icon file: %s" % (e))
                 del apk['icons'][density]
                 del apk['icons_src'][density]
                 empty_densities.append(density)
@@ -982,8 +982,8 @@ def scan_apk(apkcache, apkfilename, repodir, knownapks, use_date_from_apk):
                 im.thumbnail((size, size), Image.ANTIALIAS)
                 im.save(iconpath, "PNG")
                 empty_densities.remove(density)
-            except:
-                logging.warning("Invalid image file at %s" % last_iconpath)
+            except Exception as e:
+                logging.warning("Invalid image file at %s: %s" % (last_iconpath, e))
             finally:
                 if fp:
                     fp.close()