louiscad
08/24/2017, 8:09 AMprivate inline fun <reified E : Exception> throwOrReport(f: () -> Unit) {
try {
f()
} catch (e: E) { //Currently, compiler says: "Reified type is forbidden for catch parameter"
if (BuildConfig.DEBUG) throw e else <http://Timber.wtf|Timber.wtf>(e)
}
}
snrostov
08/24/2017, 8:35 AMraulraja
08/24/2017, 10:23 AMNonFatal
control mechanism that would be handy for these cases in Kotlin too, though in Scala is based on unapply and pattern matching but something similar in Kotlin would be awesome and complimentary to reified type args in exc blocks. http://www.scala-lang.org/api/2.12.1/scala/util/control/NonFatal$.html