From 1750e0a2b057ce0dcc0033490ac91b6dd3072a5b Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 27 Aug 2020 00:43:50 +0200 Subject: [PATCH] Fixed issue with meaningless stack trace for suspending methods --- src/dorkbox/network/rmi/RmiClient.kt | 6 +++--- src/dorkbox/network/rmi/RmiManagerGlobal.kt | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/dorkbox/network/rmi/RmiClient.kt b/src/dorkbox/network/rmi/RmiClient.kt index c9436ed5..0ac4ebed 100644 --- a/src/dorkbox/network/rmi/RmiClient.kt +++ b/src/dorkbox/network/rmi/RmiClient.kt @@ -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 -> { diff --git a/src/dorkbox/network/rmi/RmiManagerGlobal.kt b/src/dorkbox/network/rmi/RmiManagerGlobal.kt index 327242e5..d9ecfb00 100644 --- a/src/dorkbox/network/rmi/RmiManagerGlobal.kt +++ b/src/dorkbox/network/rmi/RmiManagerGlobal.kt @@ -398,12 +398,7 @@ internal class RmiManagerGlobal(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) {