From c15f02ed680432bb055db47f50e799707bbf2e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Wed, 22 Mar 2017 14:07:54 +0100 Subject: [PATCH] fix exception handling in dscanner and update.py --- fdroidserver/dscanner.py | 2 +- fdroidserver/update.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fdroidserver/dscanner.py b/fdroidserver/dscanner.py index 8e224bdb..10e98b31 100644 --- a/fdroidserver/dscanner.py +++ b/fdroidserver/dscanner.py @@ -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") diff --git a/fdroidserver/update.py b/fdroidserver/update.py index eb92e91b..7ad41b9a 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -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()