Fixed issue with meaningless stack trace for suspending methods

This commit is contained in:
nathan 2020-08-27 00:43:50 +02:00
parent 39503ac6d9
commit 1750e0a2b0
2 changed files with 4 additions and 9 deletions

View File

@ -260,9 +260,9 @@ internal class RmiClient(val isGlobal: Boolean,
continuation.resumeWithException(exception)
}
is Exception -> {
// reconstruct the stack trace, so the calling method knows where the method invocation happened, and can trace the call
// this stack will ALWAYS run up to this method (so we remove from the top->down, to get to the call site)
RmiUtils.cleanStackTraceForProxy(Exception(), any)
// for co-routines, it's impossible to get a legit stacktrace without impacting general performance,
// so we just don't do it.
// RmiUtils.cleanStackTraceForProxy(Exception(), any)
continuation.resumeWithException(any)
}
else -> {

View File

@ -398,12 +398,7 @@ internal class RmiManagerGlobal<CONNECTION : Connection>(logger: KLogger,
suspendResult = null
} else if (suspendResult is Exception) {
RmiUtils.cleanStackTraceForImpl(suspendResult, true)
val fancyName = RmiUtils.makeFancyMethodName(cachedMethod)
val exception = Exception("Error invoking method: $fancyName", suspendResult)
RmiUtils.cleanStackTraceForImpl(exception, true)
endPoint.listenerManager.notifyError(connection, exception)
endPoint.listenerManager.notifyError(connection, suspendResult)
}
if (sendResponse) {