Using Python exceptions, 'try-except-finally' wrapper code, is what you need. Where to put those, what to wrap, what to do and how to handle program continuation, will very much depend on the particular code and application.
The simplest solution for embedded code which has to keep on running is to put your code in a 'main' routine, call that in an infinite loop and wrap that. Something like ...But you may find you want more localised exception trapping as well.
The simplest solution for embedded code which has to keep on running is to put your code in a 'main' routine, call that in an infinite loop and wrap that. Something like ...
Code:
def main(): ...while True: try: main() except Exception as e: ReportException(e)
Statistics: Posted by hippy — Wed Apr 03, 2024 2:42 pm