From 56298ed57fcd338f94f7cf6c6b46e046dfafdc76 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 25 Jun 2022 15:36:46 +0100 Subject: [PATCH] Add graceful error message for invalid json files --- app/tasks/importtasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/tasks/importtasks.py b/app/tasks/importtasks.py index eded839e..cd9e66e1 100644 --- a/app/tasks/importtasks.py +++ b/app/tasks/importtasks.py @@ -13,6 +13,7 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from json import JSONDecodeError import gitdb import json @@ -138,6 +139,8 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path): do_edit_package(package.author, package, False, False, data, "Post release hook") except LogicError as e: raise TaskError(e.message) + except JSONDecodeError as e: + raise TaskError("Whilst reading .cdb.json: " + str(e)) except IOError: pass