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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-19 11:31:14 +01:00
commit 666f778e05

View file

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