Skip to content

Commit 736fd49

Browse files
Print stacktrace for unhandled app exceptions
1 parent f3b67ee commit 736fd49

File tree

1 file changed

+9
-0
lines changed
  • internal_filesystem/lib/mpos/ui

1 file changed

+9
-0
lines changed

internal_filesystem/lib/mpos/ui/view.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import lvgl as lv
2+
import sys
3+
24
from ..apps import restart_launcher
35
from .focus import save_and_clear_current_focusgroup
46
from .topmenu import open_bar
@@ -13,10 +15,12 @@ def setContentView(new_activity, new_screen):
1315
current_activity.onPause(current_screen)
1416
except Exception as e:
1517
print(f"onPause caught exception: {e}")
18+
sys.print_exception(e)
1619
try:
1720
current_activity.onStop(current_screen)
1821
except Exception as e:
1922
print(f"onStop caught exception: {e}")
23+
sys.print_exception(e)
2024

2125
from .util import close_top_layer_msgboxes
2226
close_top_layer_msgboxes()
@@ -28,12 +32,14 @@ def setContentView(new_activity, new_screen):
2832
new_activity.onStart(new_screen)
2933
except Exception as e:
3034
print(f"onStart caught exception: {e}")
35+
sys.print_exception(e)
3136
lv.screen_load_anim(new_screen, lv.SCR_LOAD_ANIM.OVER_LEFT, 500, 0, False)
3237
if new_activity:
3338
try:
3439
new_activity.onResume(new_screen)
3540
except Exception as e:
3641
print(f"onResume caught exception: {e}")
42+
sys.print_exception(e)
3743

3844
def remove_and_stop_all_activities():
3945
global screen_stack
@@ -47,14 +53,17 @@ def remove_and_stop_current_activity():
4753
current_activity.onPause(current_screen)
4854
except Exception as e:
4955
print(f"onPause caught exception: {e}")
56+
sys.print_exception(e)
5057
try:
5158
current_activity.onStop(current_screen)
5259
except Exception as e:
5360
print(f"onStop caught exception: {e}")
61+
sys.print_exception(e)
5462
try:
5563
current_activity.onDestroy(current_screen)
5664
except Exception as e:
5765
print(f"onDestroy caught exception: {e}")
66+
sys.print_exception(e)
5867
if current_screen:
5968
current_screen.clean()
6069

0 commit comments

Comments
 (0)