chiark / gitweb /
Exception handling improvements
[fdroidserver.git] / fdroidserver / build.py
index 3870d7e3a3f2d00aadac72e2d314302840f48c7e..3c3b96f9223ecd4ad7c1bc28b4da1f4574c506e2 100644 (file)
@@ -1050,20 +1050,23 @@ def main():
                 logfile.write(str(be))
                 logfile.close()
                 reason = str(be).split('\n', 1)[0] if options.verbose else str(be)
-                print("Could not build app %s due to BuildException: %s" % (
+                logging.error("Could not build app %s due to BuildException: %s" % (
                     app['id'], reason))
                 if options.stop:
                     sys.exit(1)
                 failed_apps[app['id']] = be
                 wikilog = be.get_wikitext()
             except VCSException as vcse:
-                print("VCS error while building app %s: %s" % (app['id'], vcse))
+                reason = str(vcse).split('\n', 1)[0] if options.verbose else str(vcse)
+                logging.error("VCS error while building app %s: %s" % (
+                    app['id'], reason))
                 if options.stop:
                     sys.exit(1)
                 failed_apps[app['id']] = vcse
                 wikilog = str(vcse)
             except Exception as e:
-                print("Could not build app %s due to unknown error: %s" % (app['id'], traceback.format_exc()))
+                logging.error("Could not build app %s due to unknown error: %s" % (
+                    app['id'], traceback.format_exc()))
                 if options.stop:
                     sys.exit(1)
                 failed_apps[app['id']] = e