I install a global exception handler in -applicationWillFinishLaunching. Here is my implementation:
window.addEventListener('error', function (e) {
var userInfo = @{
CPLocalizedDescriptionKey: "Sorry, but a run-time error occurred. Please take a moment to report the error.",
CPLocalizedFailureReasonErrorKey: "Your browser window will be reloaded to clear the error or CERTS may not operate correctly.",
CPLocalizedRecoverySuggestionErrorKey: LMS_REPORT_ERROR_ACTION,
LMS_ERROR_EVENT_KEY: e,
// recovery should reload browser to clear errors
CPRecoveryAttempterErrorKey: function () { window.location.reload(false); }
};
var error = [CPError errorWithDomain:CPCappuccinoErrorDomain code:LMS_RUNTIME_ERROR userInfo:userInfo];
[self presentError:error];
});
It used to catch every exception, sometimes even exceptions caused by browser plugins under Chrome. Recently, however, it doesn’t work as reliably as it used to, at least under Chrome, and I don’t recall when that began. Perhaps because the framework is overriding the global handler under certain situations. That may be why the LPCrashReporter author(s) hack the objj_msgSend implementation.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"