summaryrefslogtreecommitdiff
path: root/wasp
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-18 14:32:46 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-26 14:01:48 (GMT)
commit5b277e94f11474e3c34f943ee63b9155e96777e2 (patch)
treeaed50e0167e5048164fde1b0bc5096e01b67fba6 /wasp
parent604966d9db70887f2da1f8efcd19b0b6db30d61a (diff)
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.
Diffstat (limited to 'wasp')
-rw-r--r--wasp/wasp.py5
1 files changed, 3 insertions, 2 deletions
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