Commit 483cec7f authored by Robin Mueller's avatar Robin Mueller
Browse files

better error checking

parent f6653aa9
......@@ -66,7 +66,15 @@ def assign_tmtc_commander_hooks(hook_object: TmTcHookBase):
from tmtc_core.core.definitions import CoreGlobalIds
if hook_object is None:
logger.error("Passed hook base object handle is invalid! Terminating..")
logger.error("Passed hook base object handle is invalid. Terminating..")
# Check whether all required hook functions have bee implemented properly, Python
# does not enforce this.
if hook_object.get_version is None or hook_object.add_globals_pre_args_parsing is None \
or hook_object.add_globals_post_args_parsing is None:
logger.error("Passed hook base object handle is invalid. "
"Abstract functions have to be implemented!")
# Insert hook object handle into global dictionary so it can be used by the TMTC commander
update_global(CoreGlobalIds.TMTC_HOOK, hook_object)
......@@ -84,8 +92,9 @@ def set_up_tmtc_commander(use_gui: bool, reduced_printout: bool):
# of the commander core.
hook_obj_raw = get_global(CoreGlobalIds.TMTC_HOOK)
if hook_obj_raw is None:"No valid hook object found. Please make sure to implement it, instantiate it "
"and pass it via the assign_tmtc_commander_hooks function!")"No valid hook object found. "
"initialize_tmtc_commander needs to be called first. Terminating..")
hook_obj = cast(TmTcHookBase, hook_obj_raw)
if not reduced_printout:
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