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):