All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.io.ktor.util.pipeline.StackTraceRecoverJvm.kt Maven / Gradle / Ivy

/*
 * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
 */

package io.ktor.util.pipeline

import io.ktor.utils.io.*

internal actual fun Throwable.withCause(cause: Throwable?): Throwable {
    if (cause == null || this.cause == cause) {
        return this
    }

    val result = tryCopyException(this, cause) ?: return this
    result.stackTrace = stackTrace

    return result
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy