Bug 1878021 - Print the messages for `InvalidRepoPath` and `MissingVCSTool` when `_get_repository_object` encounters those exceptions r=firefox-build-system-reviewers,glandium

This should make it easier for a user to troubleshoot the problem,
instead of trying to decipher a subsequent exception from a function
call being attempted on the `None` returned by this function.

Differential Revision: https://phabricator.services.mozilla.com/D200496
This commit is contained in:
ahochheiden 2024-02-08 07:08:53 +00:00
Родитель b3798337bd
Коммит d44d931081
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -4,6 +4,7 @@
import abc
import re
import sys
from pathlib import Path
from threading import Thread
@ -187,7 +188,8 @@ def _delete_server_name(sentry_event, _):
def _get_repository_object(topsrcdir: Path):
try:
return get_repository_object(str(topsrcdir))
except (InvalidRepoPath, MissingVCSTool):
except (InvalidRepoPath, MissingVCSTool) as e:
print(f"Warning: {e}", file=sys.stderr)
return None