From a3a73726129f7aa9cc12bbdc1f01700189936284 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Thu, 14 Mar 2024 23:50:33 +0000 Subject: main: Stringify project name in error_info If a project can't be removed from checkout due to uncommitted changes present, error.project is type of Project and not a string (as it is in some cases). Project is not JSON serializable, resulting in exception within exception handler: TypeError: Object of type Project is not JSON serializable This change casts project to string as a defensive mechanism. It also passes project name instead of project object. Change-Id: Ie7b782d73dc3647975755d5a3774d16ea6cd5348 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/413877 Tested-by: Josip Sokcevic Reviewed-by: Gavin Mak Commit-Queue: Josip Sokcevic --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.py') diff --git a/main.py b/main.py index 2e1058d4..b00aadbd 100755 --- a/main.py +++ b/main.py @@ -425,7 +425,7 @@ class _Repo: error_info = json.dumps( { "ErrorType": type(error).__name__, - "Project": project, + "Project": str(project), "Message": str(error), } ) -- cgit v1.2.3-54-g00ecf