Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20852#discussion_r175380424
--- Diff: mllib/src/test/scala/org/apache/spark/ml/util/MLTest.scala ---
@@ -119,9 +119,15 @@ trait MLTest extends StreamTest with TempDirectory {
self: Suite =>
expectedMessagePart : String,
firstResultCol: String) {
+ def hasExpectedMessageDirectly(exception: Throwable): Boolean =
+ exception.getMessage.contains(expectedMessagePart)
+
def hasExpectedMessage(exception: Throwable): Boolean =
- exception.getMessage.contains(expectedMessagePart) ||
- (exception.getCause != null &&
exception.getCause.getMessage.contains(expectedMessagePart))
+ hasExpectedMessageDirectly(exception) || (
+ exception.getCause != null && (
+ hasExpectedMessageDirectly(exception.getCause) || (
+ exception.getCause.getCause != null &&
+ hasExpectedMessageDirectly(exception.getCause.getCause))))
--- End diff --
Why not use a loop to check inner exception ? So it can check any deep
level exception msg.
Maybe we cannot make sure the possible root exception max level (even in
master version)
@jkbradley What do you think ?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]