macOS: Print out unhandled exceptions
This commit is contained in:
parent
a56471f7ed
commit
ce63ddfe54
1 changed files with 7 additions and 0 deletions
|
|
@ -861,10 +861,17 @@ - (BOOL)openFilesFromPasteboard:(NSPasteboard *)pasteboard type:(int)type {
|
|||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
static void
|
||||
uncaughtExceptionHandler(NSException *exception) {
|
||||
log_error("Unhandled exception in Cocoa: %s", [[exception description] UTF8String]);
|
||||
log_error("Stack trace:\n%s", [[exception.callStackSymbols description] UTF8String]);
|
||||
}
|
||||
|
||||
bool
|
||||
init_cocoa(PyObject *module) {
|
||||
memset(&global_shortcuts, 0, sizeof(global_shortcuts));
|
||||
if (PyModule_AddFunctions(module, module_methods) != 0) return false;
|
||||
register_at_exit_cleanup_func(COCOA_CLEANUP_FUNC, cleanup);
|
||||
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue