Skip to content

Commit 7b6b123

Browse files
authored
utils.py: update file not found exception message
Previous message implies the file is found but the contents are not valid. Especially when referring to a YAML file. This adds a clearer message and specifies where the code has looked for the file.
1 parent 80b50f4 commit 7b6b123

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

infrahub_sdk/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def write_to_file(path: Path, value: Any) -> bool:
353353

354354
def read_file(file_name: Path) -> str:
355355
if not file_name.is_file():
356-
raise FileNotValidError(name=str(file_name), message=f"{file_name} is not a valid file")
356+
raise FileNotValidError(name=str(file_name), message=f"{file_name}: not found at {Path.cwd()}")
357357
try:
358358
with Path.open(file_name, encoding="utf-8") as fobj:
359359
return fobj.read()

0 commit comments

Comments
 (0)