safely
inline suspend fun <T> safely(noinline onException: ExceptionHandler<T> = defaultSafelyExceptionHandler, noinline block: suspend CoroutineScope.() -> T): T
It will run block inside of supervisorScope to avoid problems with catching of exceptions
Priorities of ExceptionHandlers:
onException In case if custom (will be used anyway if not defaultSafelyExceptionHandler)
CoroutineContext.get with SafelyExceptionHandlerKey as key
Remember, that ExceptionHandler from CoroutineContext.get will be used anyway if it is available. After it will be called onException
Parameters
on Exception
Will be called when happen exception inside of block. By default will throw exception - this exception will be available for catching