# handleSafely - docs

docs / com.github.insanusmokrassar.TelegramBotAPI.utils / handleSafely

# handleSafely

(common) `suspend inline fun <T> handleSafely(noinline onException: suspend (Exception) -> T = { throw it }, noinline block: suspend CoroutineScope.() -> T): T` (source)

It will run block inside of supervisorScope to avoid problems with catching of exceptions

### Parameters

`onException` - Will be called when happen exception inside of block. By default will throw exception - this exception will be available for catching