-
-
Save selmanon/4211f176653686cd96e1bea7547093d9 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
RxJavaPlugins.setErrorHandler { e: Throwable -> | |
when (e) { | |
is UndeliverableException -> logger.logException(e) | |
is IOException -> logger.logException(e) // fine, irrelevant network problem or API that throws on cancellation | |
is InterruptedException -> logger.logException(e) // fine, some blocking code was interrupted by a dispose call | |
is NullPointerException -> logger.logException(e) // that's likely a bug in the application | |
is IllegalArgumentException -> logger.logException(e) // that's likely a bug in the application | |
is IllegalStateException -> logger.logException(e) // that's a bug in RxJava or in a custom operator | |
else -> { | |
logger.logException(e) | |
currentThread().uncaughtExceptionHandler!!.uncaughtException( | |
currentThread(), | |
e | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment