Created
January 27, 2021 01:30
-
-
Save amsterdatech/9074bfe6edde8270c8b49c4d34c00a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* You can report it using trackEvent or do your own logic, but remember, you are running in the Main Thread. | |
* Besides, you shouldn't rely on heavy libraries like RxJava, but Coroutines or Executors are easy to follow as well | |
*/ | |
override fun uncaughtException(thread: Thread, throwable: Throwable) { | |
try { | |
analytics(context) | |
.track { | |
name = EventName.EXCEPTION | |
EventName.STACK_TRACE to extractStackTraceInfo(throwable) | |
EventName.MESSAGE to throwable.message.toString() | |
EventName.CAUSE to throwable.cause.toString() | |
} | |
} finally { | |
/** | |
* Dispatch to default Android handler to show system dialog or finish the app (System.exit(0) or Activity.finish()) | |
*/ | |
defaultHandler?.uncaughtException(thread, throwable) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment