mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-03 23:29:46 +00:00
deploy: ea497ea488
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
<div class="cover ">
|
||||
<h1 class="cover"><span>safely</span><wbr></wbr><span>With</span><wbr></wbr><span>Context</span><wbr></wbr><span>Exception</span><wbr></wbr><span><span>Handler</span></span></h1>
|
||||
</div>
|
||||
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/commonMain"><div class="symbol monospace"><span class="token keyword">suspend </span><span class="token keyword">fun </span><span class="token operator"><</span><span class="token keyword"></span><a href="safely-with-context-exception-handler.html">T</a><span class="token operator">> </span><a href="safely-with-context-exception-handler.html"><span class="token function">safelyWithContextExceptionHandler</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">contextExceptionHandler<span class="token operator">: </span><a href="-exception-handler/index.html">ExceptionHandler</a><span class="token operator"><</span><span class="token keyword"></span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a><span class="token operator">></span><span class="token punctuation">, </span></span><span class="parameter ">safelyExceptionHandler<span class="token operator">: </span><a href="-exception-handler/index.html">ExceptionHandler</a><span class="token operator"><</span><span class="token keyword"></span><a href="safely-with-context-exception-handler.html">T</a><span class="token operator">></span><span class="token operator"> = </span>defaultSafelyExceptionHandler<span class="token punctuation">, </span></span><span class="parameter ">block<span class="token operator">: </span><span class="token keyword">suspend </span><span class="token keyword"></span><span data-unresolved-link="kotlinx.coroutines/CoroutineScope///PointingToDeclaration/">CoroutineScope</span><span class="token punctuation">.</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator"> -> </span><span class="token keyword"></span><a href="safely-with-context-exception-handler.html">T</a></span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="safely-with-context-exception-handler.html">T</a><span class="clearfix"><span class="floating-right">(<a href="https://github.com/InsanusMokrassar/MicroUtils/blob/master//coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt#L64">source</a>)</span></span></div><p class="paragraph">This method will set new <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/index.html">coroutineContext</a> with <a href="-context-safely-exception-handler/index.html">ContextSafelyExceptionHandler</a>. In case if <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/index.html">coroutineContext</a> already contains <a href="-context-safely-exception-handler/index.html">ContextSafelyExceptionHandler</a>, <a href="-context-safely-exception-handler/handler.html">ContextSafelyExceptionHandler.handler</a> will be used BEFORE <a href="safely-with-context-exception-handler.html">contextExceptionHandler</a> in case of exception.</p><p class="paragraph">After all, will be called <span data-unresolved-link="kotlinx.coroutines//withContext/#kotlin.coroutines.CoroutineContext#kotlin.coroutines.SuspendFunction1[kotlinx.coroutines.CoroutineScope,TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration/">withContext</span> method with created <a href="-context-safely-exception-handler/index.html">ContextSafelyExceptionHandler</a> and block which will call <a href="safely.html">safely</a> method with <a href="safely-with-context-exception-handler.html">safelyExceptionHandler</a> as onException parameter and <a href="safely-with-context-exception-handler.html">block</a> as execution block</p></div></div>
|
||||
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/commonMain"><div class="symbol monospace"><span class="token keyword">suspend </span><span class="token keyword">fun </span><span class="token operator"><</span><a href="safely-with-context-exception-handler.html">T</a><span class="token operator">> </span><a href="safely-with-context-exception-handler.html"><span class="token function">safelyWithContextExceptionHandler</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">contextExceptionHandler<span class="token operator">: </span><a href="-exception-handler/index.html">ExceptionHandler</a><span class="token operator"><</span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a><span class="token operator">></span><span class="token punctuation">, </span></span><span class="parameter ">safelyExceptionHandler<span class="token operator">: </span><a href="-exception-handler/index.html">ExceptionHandler</a><span class="token operator"><</span><a href="safely-with-context-exception-handler.html">T</a><span class="token operator">></span><span class="token operator"> = </span>defaultSafelyExceptionHandler<span class="token punctuation">, </span></span><span class="parameter ">block<span class="token operator">: </span><span class="token keyword">suspend </span><span data-unresolved-link="kotlinx.coroutines/CoroutineScope///PointingToDeclaration/">CoroutineScope</span><span class="token punctuation">.</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator"> -> </span><a href="safely-with-context-exception-handler.html">T</a></span></span><span class="token punctuation">)</span><span class="token operator">: </span><a href="safely-with-context-exception-handler.html">T</a><span class="clearfix"><span class="floating-right">(<a href="https://github.com/InsanusMokrassar/MicroUtils/blob/master//coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt#L64">source</a>)</span></span></div><p class="paragraph">This method will set new <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/index.html">coroutineContext</a> with <a href="-context-safely-exception-handler/index.html">ContextSafelyExceptionHandler</a>. In case if <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/index.html">coroutineContext</a> already contains <a href="-context-safely-exception-handler/index.html">ContextSafelyExceptionHandler</a>, <a href="-context-safely-exception-handler/handler.html">ContextSafelyExceptionHandler.handler</a> will be used BEFORE <a href="safely-with-context-exception-handler.html">contextExceptionHandler</a> in case of exception.</p><p class="paragraph">After all, will be called <span data-unresolved-link="kotlinx.coroutines//withContext/#kotlin.coroutines.CoroutineContext#kotlin.coroutines.SuspendFunction1[kotlinx.coroutines.CoroutineScope,TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration/">withContext</span> method with created <a href="-context-safely-exception-handler/index.html">ContextSafelyExceptionHandler</a> and block which will call <a href="safely.html">safely</a> method with <a href="safely-with-context-exception-handler.html">safelyExceptionHandler</a> as onException parameter and <a href="safely-with-context-exception-handler.html">block</a> as execution block</p></div></div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2024 Copyright</span><span
|
||||
|
Reference in New Issue
Block a user