rocketraman
12/21/2016, 9:50 PMinline fun <T> tryOrNullWhen(vararg ignore: KClass<out Exception>, body: () -> T): T? =
try { body() } catch (e: Exception) { if(ignore.any { it.java == e.javaClass }) null else throw e }
used like: tryOrNullWhen(SomeException::class, SomeOtherException::class) { something() }