diff options
author | Josip Sokcevic <sokcevic@chromium.org> | 2024-03-14 23:50:33 +0000 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-03-15 19:26:10 +0000 |
commit | a3a73726129f7aa9cc12bbdc1f01700189936284 (patch) | |
tree | a1fe5d9c56397232a4be4df876e446906310254d /main.py | |
parent | fff1d2d74c2078b62cc9c2561330e41a842dc197 (diff) | |
download | git-repo-a3a73726129f7aa9cc12bbdc1f01700189936284.tar.gz |
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 <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -425,7 +425,7 @@ class _Repo: | |||
425 | error_info = json.dumps( | 425 | error_info = json.dumps( |
426 | { | 426 | { |
427 | "ErrorType": type(error).__name__, | 427 | "ErrorType": type(error).__name__, |
428 | "Project": project, | 428 | "Project": str(project), |
429 | "Message": str(error), | 429 | "Message": str(error), |
430 | } | 430 | } |
431 | ) | 431 | ) |