File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 56
56
Local<v8::String> messageV8String = message->Get ();
57
57
std::string messageString = tns::ToString (isolate, messageV8String);
58
58
NSString * name = [NSString stringWithFormat: @" NativeScript encountered a fatal error: %s \n at \n %s " , messageString.c_str (), stackTrace.c_str ()];
59
- NSException * objcException = [NSException exceptionWithName: name reason: nil userInfo: @{ @" sender" : @" onUncaughtError" }];
60
-
61
- NSLog (@" ***** Fatal JavaScript exception - application has been terminated. *****\n " );
62
- NSLog (@" %@ " , [objcException description ]);
63
- @throw objcException;
59
+ // we throw the exception on main thread
60
+ // otherwise it seems that when getting NSException info from NSSetUncaughtExceptionHandler
61
+ // we are missing almost all data. No explanation for why yet
62
+ dispatch_async (dispatch_get_main_queue (), ^(void ) {
63
+ NSException * objcException = [NSException exceptionWithName: name reason: nil userInfo: @{ @" sender" : @" onUncaughtError" }];
64
+
65
+ NSLog (@" ***** Fatal JavaScript exception - application has been terminated. *****\n " );
66
+ NSLog (@" %@ " , [objcException description ]);
67
+ @throw objcException;
68
+ });
64
69
} else {
65
70
NSLog (@" NativeScript discarding uncaught JS exception!" );
66
71
}
You can’t perform that action at this time.
0 commit comments