All Downloads are FREE. Search and download functionalities are using the official Maven repository.

alakazam.kotlin.core.ThrowChecks.kt Maven / Gradle / Ivy

There is a newer version: 4.7.0
Show newest version
@file:Suppress("TooGenericExceptionThrown")

package alakazam.kotlin.core

public inline fun  throwsSpecific(block: () -> Unit): Boolean = try {
  block()
  false
} catch (e: Throwable) {
  Expected::class.isInstance(e)
}

public fun throwsAnyException(block: () -> Unit): Boolean = try {
  block()
  false
} catch (e: Exception) {
  true
}

public fun throwsAnyThrowable(block: () -> Unit): Boolean = try {
  block()
  false
} catch (e: Throwable) {
  true
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy