[elbe-devel] [PATCH 0/3] elbepack: introduce cli exception handling framework
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Thu Jul 18 14:47:23 CEST 2024
The current practice of sprinkling explicit calls to sys.exit() all
through the codebase has various issues:
* The stacktrace is always lost, making debugging harder
* Code calling sys.exit() is non-composable
* Any changes to the error-reporting have to applied all over the codebase
Introduce a new reporting framework which works through sys.excepthook
and a small helper to attach additional information to arbitrary exceptions.
This helper avoids the mentioned pitfalls.
It also preserves the possibility for per-error exitcodes and allows a
stepwise migration process.
In addition, other exceptions that have no explicit handling set up,
while currently printing a enduser-unfriendly stacktrace now
automatically use nicer formatting.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
Thomas Weißschuh (3):
elbepack: introduce cli exception handling framework
elbepack: main: wrap entrypoint with improved exception reporting
elbepack: initvmaction: use elbepack.cli error handling
elbepack/cli.py | 91 ++++++++++++++
elbepack/initvmaction.py | 308 +++++++++++++++------------------------------
elbepack/main.py | 12 +-
elbepack/tests/test_cli.py | 98 +++++++++++++++
4 files changed, 302 insertions(+), 207 deletions(-)
---
base-commit: 97fd95a0f4d5f99b86eb5195df059cf87ad37e0a
change-id: 20240703-cli-exceptions-c3bc625accb7
Best regards,
--
Thomas Weißschuh <thomas.weissschuh at linutronix.de>
More information about the elbe-devel
mailing list