if command fails, print command and exit code, regardless if error message is set

This commit is contained in:
Jörg Thalheim
2024-09-25 18:40:28 +02:00
parent 7b93ef6704
commit 6bd1bc894e

View File

@@ -414,8 +414,11 @@ def main() -> None:
args.func(args)
except ClanError as e:
if isinstance(e, ClanCmdError):
msg = ""
if e.cmd.msg:
log.fatal(e.cmd.msg)
msg += f"{e.cmd.msg}: "
msg += f"command exited with code {e.cmd.returncode}: {e.cmd.command}"
log.error(msg) # noqa: TRY400
sys.exit(1)
log.fatal(e.msg)