mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-04-25 10:25:55 +02:00
stree.serdes: Only ignore ENOENT for -include
-include ignores too many failures. It should only ignore ENOENT, all others should throw an exception regardless. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
1347a34481
commit
30c81af1b0
1 changed files with 4 additions and 6 deletions
|
|
@ -88,18 +88,16 @@ def _read_lines_from_one_path(path: str, throw=True, level=0, log_prio=INFO, pat
|
|||
include_path = dir_name + '/' + include_path
|
||||
include_lines = _read_lines(include_path, throw=(not optional), level=level+1, paths_buf=paths_buf)
|
||||
if include_lines is None:
|
||||
msg = f'{path}: Failed to process "{line}"'
|
||||
slog(DEBUG, line)
|
||||
slog(DEBUG, f'{path}: Failed to process "{line}"')
|
||||
continue
|
||||
ret.extend(include_lines)
|
||||
continue
|
||||
ret.append(line)
|
||||
return ret
|
||||
except Exception as e:
|
||||
msg = f'Failed to read file "{path}": {e}'
|
||||
if throw:
|
||||
raise Exception(msg)
|
||||
slog(DEBUG, msg)
|
||||
slog(ERR, f'Failed to read file "{path}": {str(e)}')
|
||||
if throw or not isinstance(e, FileNotFoundError):
|
||||
raise
|
||||
return None
|
||||
|
||||
def _read_lines(path: str, throw=True, level=0, log_prio=INFO, paths_buf=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue