Skip to content

Commit 762d923

Browse files
committed
dist-git-client: nicer error output for not-matched hostnames
If hostname isn't found in dist-git-client configuration, print a reasonable ERROR instead of KeyError traceback.
1 parent f753168 commit 762d923

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

dist-git-client/dist_git_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,12 @@ def get_distgit_config(config, forked_from=None):
207207
else:
208208
hostname = parsed_url.hostname
209209

210-
prefixes = config["clone_host_map"][hostname]
210+
try:
211+
prefixes = config["clone_host_map"][hostname]
212+
except KeyError as err:
213+
raise RuntimeError(f"{hostname} (detected from clone URL) not "
214+
"found in dist-git-client configuration") from err
215+
211216
prefix_found = None
212217
for prefix in prefixes.keys():
213218
if not parsed_url.path.startswith(prefix):

0 commit comments

Comments
 (0)