From 30c81af1b010114243ea13b50c3ab52e398ccdbd Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 3 Apr 2026 13:46:53 +0200 Subject: [PATCH] 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 --- tools/python/jwutils/stree/serdes.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/python/jwutils/stree/serdes.py b/tools/python/jwutils/stree/serdes.py index b47db38..1249f86 100644 --- a/tools/python/jwutils/stree/serdes.py +++ b/tools/python/jwutils/stree/serdes.py @@ -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):