DaveS
15 May 2020 00:17
1
Swift seems to have the standard array of error tools TRY/CATCH, THROW etc.
which are all well and good if you know where particular errors might occur.
But the app I have (PILOT) could have issues with something the user entered that might “look” ok to the parser, but when it is executed, it goes boom.
I have searched for how to handle these on a app wide basis… I want to at least tell the user, “Hey the reason your app is frozen is because it crashed”
“Xojo for iOS” has the same “Xojo UnhandledException” event, does anyone know how they implemented that? or is it something the compiler threads throughout the code basically wrapping things in a massive TRY/CATCH? OR???
That has more to do with how the app is constructed by Xojo and then run by the runtime
If you get a crash log you will often see this (handy to know how to crash a Xojo app at will fwiw)
see frame # 29 which has “CallFunctionWithExceptionHandling”
Thats about where Xojo sets up everything so they can catch app wide exceptions
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 My Application.debug 0x0000000104792290 Window1.Window1.Event_Paint%%o<Window1.Window1>oA1o<REALbasic.Rect> + 192 (/Window1:50)
1 XojoFramework 0x00000001049a7a96 RuntimeViewWindow::Redraw(Graphics*, std::__1::vector<xojo::Rectxojo::Points , std::__1::allocator<xojo::Rectxojo::Points > > const&) + 572
2 XojoFramework 0x000000010492e0e1 0x104844000 + 958689
3 XojoFramework 0x0000000104936a98 0x104844000 + 993944
4 com.apple.AppKit 0x00007fff2ce5621e _NSViewDrawRect + 66
5 com.apple.AppKit 0x00007fff2ce54aac -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inContext:shouldChangeFontReferenceColor:stopAtLayerBackedViews:] + 1627
6 com.apple.AppKit 0x00007fff2ce5443f __46-[NSView(NSLayerKitGlue) drawLayer:inContext:]block_invoke + 192
7 com.apple.AppKit 0x00007fff2ce5419c -[NSView(NSLayerKitGlue) drawViewBackingLayer:inContext:drawingHandler:] + 1720
8 com.apple.QuartzCore 0x00007fff3a1f0e02 CABackingStoreUpdate + 577
9 com.apple.QuartzCore 0x00007fff3a252a0d invocation function for block in CA::Layer::display () + 53
10 com.apple.QuartzCore 0x00007fff3a1f0020 -[CALayer _display] + 1830
11 com.apple.AppKit 0x00007fff2ce5374e _NSBackingLayerDisplay + 528
12 com.apple.AppKit 0x00007fff2ce37c4f -[_NSViewBackingLayer display] + 811
13 com.apple.QuartzCore 0x00007fff3a1ef551 CA::Layer::display_if_needed(CA::Transaction*) + 627
14 com.apple.QuartzCore 0x00007fff3a1dd7c6 CA::Context::commit_transaction(CA::Transaction*) + 342
15 com.apple.QuartzCore 0x00007fff3a1dcea6 CA::Transaction::commit() + 596
16 com.apple.AppKit 0x00007fff2ce2e84d __65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke + 274
17 com.apple.CoreFoundation 0x00007fff2f7a3384 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
18 com.apple.CoreFoundation 0x00007fff2f7a32b9 __CFRunLoopDoObservers + 451
19 com.apple.CoreFoundation 0x00007fff2f745e4e __CFRunLoopRun + 1143
20 com.apple.CoreFoundation 0x00007fff2f745785 CFRunLoopRunSpecific + 459
21 com.apple.HIToolbox 0x00007fff2e9961ab RunCurrentEventLoopInMode + 292
22 com.apple.HIToolbox 0x00007fff2e995ded ReceiveNextEventCommon + 355
23 com.apple.HIToolbox 0x00007fff2e995c76 _BlockUntilNextEventMatchingListInModeWithFilter + 64
24 com.apple.AppKit 0x00007fff2cd2d77d _DPSNextEvent + 1135
25 com.apple.AppKit 0x00007fff2cd2c46b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1361
26 XojoFramework 0x00000001049192f5 0x104844000 + 873205
27 XojoFramework 0x0000000104919339 0x104844000 + 873273
28 My Application.debug 0x00000001047039a5 Application._CallFunctionWithExceptionHandling%%op + 181
29 XojoFramework 0x0000000104a9e4bb CallFunctionWithExceptionHandling(void (*)()) + 262
30 XojoFramework 0x00000001049192a2 0x104844000 + 873122
31 com.apple.AppKit 0x00007fff2cd26588 -[NSApplication run] + 699
32 XojoFramework 0x0000000104a9c82d RuntimeRun + 42
33 My Application.debug 0x000000010475c883 REALbasic._RuntimeRun + 19
34 My Application.debug 0x000000010479804e _Main + 846 (/#main:93 )
35 My Application.debug 0x0000000104797503 main + 19
36 libdyld.dylib 0x00007fff5b76d3d5 start + 1