# safelyWithContextExceptionHandler

suspend fun < T > safelyWithContextExceptionHandler (contextExceptionHandler: ExceptionHandler < Unit >, safelyExceptionHandler: ExceptionHandler < T > = defaultSafelyExceptionHandler, block: suspend CoroutineScope.() -> T ): T (source)

This method will set new coroutineContext with ContextSafelyExceptionHandler. In case if coroutineContext already contains ContextSafelyExceptionHandler, ContextSafelyExceptionHandler.handler will be used BEFORE contextExceptionHandler in case of exception.

After all, will be called withContext method with created ContextSafelyExceptionHandler and block which will call safely method with safelyExceptionHandler as onException parameter and block as execution block