-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable the configuration of the uncaught exception handler #73
base: master
Are you sure you want to change the base?
Enable the configuration of the uncaught exception handler #73
Conversation
First, apologies for the delayed response and thanks for the PR. Can you please clarify the following... if (!install && (current instanceof UncaughtExceptionHandler)) { This means our SDK's UncaughtExceptionHandler will not be called and we will lose out on reporting crashes. In the present implementation we anyway call the Thread's default exception handler after logging crash data - why is that not ok - what is it that will break. |
No worries :)
My rationale for this was simply to have a method to cleanly "reset" to the previous state. If I install the uncaught exception handler, the previously set exception handler is not lost, but stored in our custom handler (and called eventually). Now, if I decide to uninstall it again, any previous exception handler is reinstated, so the situation is identical to what it was before I installed it in first place.
It was mostly a matter of cleaning things up. Otherwise a call to |
So in summary, we will call the original as we do today after logging crashes - so no behaviour coded in the originial is lost. And in unsetConext we will resurrect the default handler to the original one. ?? |
Well, since all you have there is static API at different levels, which make it hard to follow what is initialized when and where (especially from a caller's perspective), I tend to disagree as an uninstall functionality would at least be orthogonal to an install functionality, but it's your project. So I'll make the appropriate changes. |
114f39b
to
68951b6
Compare
@svkrish Please have another 👀 |
any updates on this? |
Here is what I had commented last ... "So in summary, we will call the original as we do today after logging crashes - so no behaviour coded in the originial is lost. And in unsetConext we will resurrect the default handler to the original one. ??" We will have the above fix in place next week. If you are looking at merging the PR, well that is what we may want to do. While the LogPersister is public we expect most application developers to use only the Analytics and Logger abstractions. If you really want to have the LogPersister the way it is suggested in the PR I suppose you could write your own LogPersister implementing the https://github.com/ibm-bluemix-mobile-services/mfp-clientsdk-android-analyticsspec/blob/master/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/logger/internal/LogPersisterInterface.java and you could encapsulate the suggested functionality in that and eventually set that to the Logger using the setLogPersister method. |
There are some use cases where a global uncaught exception handler should not be used, e.g. in library projects. With this PR it is possible to disable the setup of that handler by doing
By default, the handler is still installed, though.