use custom exceptions to improve error handling

This patch adds the KasUserError exception class to distinguish between
internal kas exceptions and user or configuration errors. Exceptions
previously raised on user errors are ported over by deriving
KasUserError. In case of user errors, only the exception message is
shown, but no stacktrace. This makes it easier for users to locate the
issue as the reason is now stated in the last line of the output.

Kas internal exceptions are not subject to this change to help the
developers to find the root cause more easily.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Felix Moessbauer
2023-05-04 04:50:17 +02:00
committed by Jan Kiszka
parent 6fa40363aa
commit a5750901c6
5 changed files with 78 additions and 5 deletions

View File

@@ -101,6 +101,12 @@ Class reference documentation
.. automodule:: kas.includehandler
:members:
``kas.kasusererror`` Module
.............................
.. automodule:: kas.kasusererror
:members:
``kas.plugins`` Module
......................