mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-04-24 10:03:36 +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_path = dir_name + '/' + include_path
|
||||||
include_lines = _read_lines(include_path, throw=(not optional), level=level+1, paths_buf=paths_buf)
|
include_lines = _read_lines(include_path, throw=(not optional), level=level+1, paths_buf=paths_buf)
|
||||||
if include_lines is None:
|
if include_lines is None:
|
||||||
msg = f'{path}: Failed to process "{line}"'
|
slog(DEBUG, f'{path}: Failed to process "{line}"')
|
||||||
slog(DEBUG, line)
|
|
||||||
continue
|
continue
|
||||||
ret.extend(include_lines)
|
ret.extend(include_lines)
|
||||||
continue
|
continue
|
||||||
ret.append(line)
|
ret.append(line)
|
||||||
return ret
|
return ret
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = f'Failed to read file "{path}": {e}'
|
slog(ERR, f'Failed to read file "{path}": {str(e)}')
|
||||||
if throw:
|
if throw or not isinstance(e, FileNotFoundError):
|
||||||
raise Exception(msg)
|
raise
|
||||||
slog(DEBUG, msg)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _read_lines(path: str, throw=True, level=0, log_prio=INFO, paths_buf=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