From 5b277e94f11474e3c34f943ee63b9155e96777e2 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sat, 18 Apr 2020 15:32:46 +0100 Subject: wasp: Manager: Avoid printing the stack trace when it can cause problems On nRF devices if we print with the NUS console disconnected (instead of never connected) then things we can end up hanging. Better only to print an exception if the watch class contains a method to do that. diff --git a/wasp/wasp.py b/wasp/wasp.py index 12a9536..3aba03e 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -12,7 +12,6 @@ import gc import machine import watch import widgets -import sys from apps import * @@ -330,7 +329,9 @@ class Manager(): except KeyboardInterrupt: raise except Exception as e: - sys.print_exception(e) + # Only print the exception if the watch provides a way to do so! + if 'print_exception' in dir(watch): + watch.print_exception(e) self.switch(CrashApp(e)) # Currently there is no code to control how fast the system -- cgit v0.10.2