Use reified type parameter for executeCatching; sync / async handlers
The unsafe cast before would throw an exception if any other generic parameter than `Exception` was used without passing the class reference explicitly. It can now also be specified whether the exception handler is to be executed sync or async, defaulting to sync.
This commit is contained in:
@@ -104,6 +104,14 @@ fun task(
|
||||
|
||||
}
|
||||
|
||||
fun runTask(sync: Boolean, runnable: () -> Unit) {
|
||||
if (sync) {
|
||||
sync(runnable)
|
||||
} else {
|
||||
async(runnable)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a synchronous task.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user