From 666f778e05b93f37da42cf7da8156b35bb4a06db Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 19 Mar 2026 11:31:14 +0100 Subject: [PATCH] cmds.distro.CmdInfo: Beautify exception logging CmdInfo._expand_macros() raises a custom exception during exception handling. Replace that by logging some details and raising the original exception to keep the stack trace readable. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/cmds/distro/CmdInfo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python/jw/pkg/cmds/distro/CmdInfo.py b/src/python/jw/pkg/cmds/distro/CmdInfo.py index 45353698..db4a6ee3 100644 --- a/src/python/jw/pkg/cmds/distro/CmdInfo.py +++ b/src/python/jw/pkg/cmds/distro/CmdInfo.py @@ -3,6 +3,7 @@ import re from argparse import Namespace, ArgumentParser +from ...lib.log import * from ..Cmd import Cmd from ..CmdProjects import CmdProjects @@ -22,7 +23,8 @@ class CmdInfo(Cmd): # export continue ret = ret.replace(patt, val) except Exception as e: - raise Exception(f'Failed to expand macro "{macro}" inside "{string}": {e}') + log(ERR, f'Failed to expand macro "{macro}" inside "{string}": {str(e)}') + raise return ret def add_arguments(self, parser: ArgumentParser) -> None: