Skip to content

Commit d4902ce

Browse files
martinrieder17o2
authored andcommitted
Catch also ValueError (#392)
In Windows might ValueError be raised instead of the already catched exceptions in some cases (depending on the Python version) Fixes point 2 of #318 (review)
1 parent edc68cf commit d4902ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wireviz/wireviz.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> Tuple[Dict, Path]:
419419
yaml_path = Path(inp).expanduser().resolve(strict=True)
420420
# if no FileNotFoundError exception happens, get file contents
421421
yaml_str = open_file_read(yaml_path).read()
422-
except (FileNotFoundError, OSError) as e:
423-
# if inp is a long YAML string, Pathlib will raise OSError: [Errno 63]
422+
except (FileNotFoundError, OSError, ValueError) as e:
423+
# if inp is a long YAML string, Pathlib will raise OSError: [errno.ENAMETOOLONG]
424424
# (in Windows, it seems OSError [errno.EINVAL] might be raised in some cases)
425425
# when trying to expand and resolve it as a path.
426426
# Catch this error, but raise any others

0 commit comments

Comments
 (0)