executeCatching

inline fun <E : Exception> executeCatching(exceptionSync: Boolean = true, noinline exceptionHandler: (E) -> Unit? = null)

Begins execution of this chained runnable, catching any exception of type E and passing it to the optional exceptionHandler.

Parameters

exceptionSync

whether the exception handler should be executed synchronously or asynchronously, defaults to true (Note that usage of any Spigot API functions requires it to be sync)