juliuszsompolski commented on code in PR #54007:
URL: https://github.com/apache/spark/pull/54007#discussion_r2735685897


##########
core/src/main/scala/org/apache/spark/util/Utils.scala:
##########
@@ -1424,32 +1421,19 @@ private[spark] object Utils
    * below the original doTryWithCallerStacktrace which triggered it, with the 
caller stack trace
    * of the current caller of getTryWithCallerStacktrace.
    *
-   * Full stack trace of the original doTryWithCallerStacktrace caller can be 
retrieved with
-   * ```
-   * ex.getSuppressed.find { e =>
-   *   e.isInstanceOf[Utils.OriginalTryStackTraceException]
-   * }
-   * ```
-   *
-   *
    * @param t Try from doTryWithCallerStacktrace
    * @return Result of the Try or rethrows the failure exception with modified 
stacktrace.
    */
   def getTryWithCallerStacktrace[T](t: Try[T]): T = t match {
+    case Failure(wrapper: OriginalTryStackTraceException) =>
+      // Unwrap to get the original exception
+      val originalEx = wrapper.getCause
+      // Stitch the stacktrace: keep the "below" part, replace "above" with 
current caller
+      originalEx.setStackTrace(

Review Comment:
   They would still see the error message on top and their call stacktrace, and 
probably ignore the suppressed listing below.
   In practical cases where I rely on it I would most likely be connected with 
a debugger anyway and then can get the original caller trace anyway... But if 
it's a bug report with no repro but only the log, the suppressed part can be 
useful in providing some triage... From user perspective it is indeed a longer 
and uglier error dump, something that @yaooqinn complained about in the past.
   For me the suppressed full original trace is useful, and only a small 
ugliness for a casual end user, but I don't insist.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to