vars: make wording nicer when multiple vars are found

This commit is contained in:
Michael Hoang
2025-04-18 09:17:29 +02:00
parent 9846bf7cbe
commit f574eee5a3

View File

@@ -28,10 +28,8 @@ def get_var(base_dir: str, machine_name: str, var_id: str) -> Var:
msg = f"No var found for search string: {var_id}" msg = f"No var found for search string: {var_id}"
raise ClanError(msg) raise ClanError(msg)
if len(results) > 1: if len(results) > 1:
error = ( error = f"Found multiple vars for {var_id}:\n - " + "\n - ".join(
f"Found multiple vars for {var_id}:\n - " [str(var) for var in results]
+ "\n - ".join([str(var) for var in results])
+ "\nBe more specific."
) )
raise ClanError(error) raise ClanError(error)
# we have exactly one result at this point # we have exactly one result at this point