Provide more information when raising exception
This commit is contained in:
parent
ff6afac510
commit
38ca3e2689
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import platform
|
||||||
import sys
|
import sys
|
||||||
from errno import EINVAL, ENAMETOOLONG
|
from errno import EINVAL, ENAMETOOLONG
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -428,6 +429,9 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> Tuple[Dict, Path]:
|
|||||||
# Catch these specific errors, but raise any others.
|
# Catch these specific errors, but raise any others.
|
||||||
|
|
||||||
if type(e) is OSError and e.errno not in (EINVAL, ENAMETOOLONG, None):
|
if type(e) is OSError and e.errno not in (EINVAL, ENAMETOOLONG, None):
|
||||||
|
print(
|
||||||
|
f"OSError(errno={e.errno}) in Python {sys.version} at {platform.platform()}"
|
||||||
|
)
|
||||||
raise e
|
raise e
|
||||||
# file does not exist; assume inp is a YAML string
|
# file does not exist; assume inp is a YAML string
|
||||||
yaml_str = inp
|
yaml_str = inp
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user