mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-03 15:19:44 +00:00
all deprecations were removed
This commit is contained in:
@@ -22,34 +22,6 @@ var defaultSafelyWithoutExceptionHandler: ExceptionHandler<Unit> = {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Key for [SafelyExceptionHandler] which can be used in [CoroutineContext.get] to get current default
|
||||
* [SafelyExceptionHandler]
|
||||
*/
|
||||
@Deprecated("This method will be useless in future major update", ReplaceWith("ContextSafelyExceptionHandlerKey", "dev.inmo.micro_utils.coroutines.ContextSafelyExceptionHandler"))
|
||||
class SafelyExceptionHandlerKey<T> : CoroutineContext.Key<SafelyExceptionHandler<T>>
|
||||
|
||||
/**
|
||||
* Shortcut for creating instance of [SafelyExceptionHandlerKey]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@Deprecated("This method will be useless in future major update", ReplaceWith("ContextSafelyExceptionHandlerKey", "dev.inmo.micro_utils.coroutines.ContextSafelyExceptionHandler"))
|
||||
inline fun <T> safelyExceptionHandlerKey() = SafelyExceptionHandlerKey<T>()
|
||||
|
||||
/**
|
||||
* Wrapper for [ExceptionHandler] which can be used in [CoroutineContext] to set local (for [CoroutineContext]) default
|
||||
* [ExceptionHandler]. To get it use [CoroutineContext.get] with key [SafelyExceptionHandlerKey]
|
||||
*
|
||||
* @see SafelyExceptionHandlerKey
|
||||
* @see ExceptionHandler
|
||||
*/
|
||||
@Deprecated("This method will be useless in future major update", ReplaceWith("ContextSafelyExceptionHandler", "dev.inmo.micro_utils.coroutines.ContextSafelyExceptionHandler"))
|
||||
class SafelyExceptionHandler<T>(
|
||||
val handler: ExceptionHandler<T>
|
||||
) : CoroutineContext.Element {
|
||||
override val key: CoroutineContext.Key<*> = safelyExceptionHandlerKey<T>()
|
||||
}
|
||||
|
||||
/**
|
||||
* This key can (and will) be used to get [ContextSafelyExceptionHandler] from [coroutineContext] of suspend functions
|
||||
* and in [ContextSafelyExceptionHandler] for defining of its [CoroutineContext.Element.key]
|
||||
|
Reference in New Issue
Block a user