mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-24 15:00:38 +08:00
Fix tryNTimes
This commit is contained in:
parent
bcaafbbe76
commit
32abb01861
@ -24,8 +24,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)
|
||||||
lastException!!.addSuppressed(e)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +42,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)
|
||||||
lastException!!.addSuppressed(e)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +61,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)
|
||||||
lastException!!.addSuppressed(e)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user