cleanAllStackTrace() returns itself

This commit is contained in:
Robinson 2023-10-24 15:14:39 +02:00
parent 59d17ea367
commit 495cb954d8
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 3 additions and 2 deletions

View File

@ -131,16 +131,17 @@ internal class ListenerManager<CONNECTION: Connection>(private val logger: Logge
*
* We only want the error message, because we do something based on it (and the full stack trace is meaningless)
*/
fun Throwable.cleanAllStackTrace() {
fun Throwable.cleanAllStackTrace(): Throwable{
val stackTrace = this.stackTrace
val size = stackTrace.size
if (size == 0) {
return
return this
}
// throw everything out
this.stackTrace = stackTrace.copyOfRange(0, 1)
return this
}
internal inline fun <reified T> add(thing: T, array: Array<T>): Array<T> {