Skip to content

Commit 57d0ef4

Browse files
author
Andrew Or
committed
try catch improveException
1 parent 874a2ca commit 57d0ef4

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@ private[serializer] object SerializationDebugger extends Logging {
3535
*/
3636
def improveException(obj: Any, e: NotSerializableException): NotSerializableException = {
3737
if (enableDebugging && reflect != null) {
38-
new NotSerializableException(
39-
e.getMessage + "\nSerialization stack:\n" + find(obj).map("\t- " + _).mkString("\n"))
38+
try {
39+
new NotSerializableException(
40+
e.getMessage + "\nSerialization stack:\n" + find(obj).map("\t- " + _).mkString("\n"))
41+
} catch {
42+
case e2: Exception =>
43+
// Fall back to old exception
44+
logWarning("Exception in serialization debugger", e2)
45+
e
46+
}
4047
} else {
4148
e
4249
}

0 commit comments

Comments
 (0)