diff --git a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/failure/FailureLoggingProviderImpl.kt b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/failure/FailureLoggingProviderImpl.kt index 17a396980..c5f54ea21 100644 --- a/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/failure/FailureLoggingProviderImpl.kt +++ b/kaspresso/src/main/kotlin/com/kaspersky/kaspresso/failure/FailureLoggingProviderImpl.kt @@ -77,7 +77,7 @@ class FailureLoggingProviderImpl( * @return transformed [error]. */ private fun Throwable.describedWith(viewMatcher: Matcher?): Throwable { - return when { + val newError = when { this is PerformException -> { PerformException.Builder() .from(this) @@ -93,7 +93,11 @@ class FailureLoggingProviderImpl( RuntimeException(message.toString()) } else -> this - }.apply { stackTrace = Thread.currentThread().stackTrace } + } + newError.stackTrace = Thread.currentThread().stackTrace + newError.addSuppressed(this) + + return newError } private fun isWebViewException(throwable: Throwable): Boolean {