mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 14:20:24 +08:00
Fix addSuppressed
This commit is contained in:
parent
92df108740
commit
37344c19d6
@ -4,9 +4,8 @@ import android.os.Build
|
|||||||
|
|
||||||
private var isAddSuppressedSupported: Boolean = true
|
private var isAddSuppressedSupported: Boolean = true
|
||||||
|
|
||||||
@MiraiInternalAPI
|
@PublishedApi
|
||||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
|
internal actual fun Throwable.addSuppressedMirai(e: Throwable) {
|
||||||
actual fun Throwable.addSuppressed(e: Throwable) {
|
|
||||||
if (this === e) {
|
if (this === e) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,8 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.utils
|
package net.mamoe.mirai.utils
|
||||||
|
|
||||||
@MiraiInternalAPI
|
@PublishedApi
|
||||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
|
internal expect fun Throwable.addSuppressedMirai(e: Throwable)
|
||||||
expect fun Throwable.addSuppressed(e: Throwable)
|
|
||||||
|
|
||||||
@MiraiInternalAPI
|
@MiraiInternalAPI
|
||||||
@Suppress("DuplicatedCode")
|
@Suppress("DuplicatedCode")
|
||||||
@ -24,7 +23,7 @@ inline fun <R> tryNTimes(repeat: Int, block: (Int) -> R): R {
|
|||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (lastException == null) {
|
if (lastException == null) {
|
||||||
lastException = e
|
lastException = e
|
||||||
} else lastException!!.addSuppressed(e)
|
} else lastException!!.addSuppressedMirai(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ inline fun <R> tryNTimesOrNull(repeat: Int, block: (Int) -> R): R? {
|
|||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (lastException == null) {
|
if (lastException == null) {
|
||||||
lastException = e
|
lastException = e
|
||||||
} else lastException!!.addSuppressed(e)
|
} else lastException!!.addSuppressedMirai(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ inline fun <R> tryNTimesOrException(repeat: Int, block: (Int) -> R): Throwable?
|
|||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (lastException == null) {
|
if (lastException == null) {
|
||||||
lastException = e
|
lastException = e
|
||||||
} else lastException!!.addSuppressed(e)
|
} else lastException!!.addSuppressedMirai(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,9 +2,8 @@ package net.mamoe.mirai.utils
|
|||||||
|
|
||||||
private var isAddSuppressedSupported: Boolean = true
|
private var isAddSuppressedSupported: Boolean = true
|
||||||
|
|
||||||
@MiraiInternalAPI
|
@PublishedApi
|
||||||
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
|
internal actual fun Throwable.addSuppressedMirai(e: Throwable) {
|
||||||
actual fun Throwable.addSuppressed(e: Throwable) {
|
|
||||||
if (this === e) {
|
if (this === e) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user