Commit 57e2f87d authored by thomas.forbriger's avatar thomas.forbriger
Browse files

csbackgen: catch any remaining exception

Implement an exception catching clause, which will respond to any
remaining exception not explicitly handled. In the past there occurred
cases, where aborts went unnoticed. This default clause works well in
csbackchk.py

The change is in response to ticket:244 at BFO.
parent a7557167
......@@ -40,6 +40,7 @@
# 09/11/2013 V0.8.1 adjusted help text
# 01/08/2019 V0.8.2 (thof): provide additional debug output
# 02/08/2019 V0.8.3 (thof): do not produce multiline log messages
# 12/01/2022 V0.8.4 (thof): catch any remaining exception
#
# =============================================================================
......@@ -54,7 +55,7 @@ import csbacklog
import pidlock
import csbackErrorCodes as eCodes
__version__ = "V0.8.3"
__version__ = "V0.8.4"
__license__ = "GPLv2+"
__author__ = "Daniel Armbruster"
__copyright__ = "Copyright (c) 2013 by Daniel Armbruster"
......@@ -185,6 +186,9 @@ def main(argv=None):
console.setFormatter(logging.Formatter( \
'%(name)-8s [%(lineno)d]: %(levelname)-8s %(message)s'))
# prepare message for try-except-else conditional
abortmessage="program aborts unexpectedly; computations are not completed!"
if argv is None:
argv = sys.argv
try:
......@@ -344,6 +348,12 @@ def main(argv=None):
logger.getLogger().error("message: %s [CODE %s]", err.msg, err.errorCode)
sys.stderr.write(str(err))
return err.errorCode
except:
logger.getLogger().error("unknown execption!")
sys.stderr.write("unknown execption!")
logger.getLogger().error(abortmessage)
sys.stderr.write(abortmessage+"\n")
return 999
else:
logger.getLogger().info("Checksumfile(s) updated.")
return 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment