Skip to content

Commit 65e53c5

Browse files
committed
[SPARK-2893]: Improve message when a spark.kryo.registrator fails.
1 parent f480d85 commit 65e53c5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ class KryoSerializer(conf: SparkConf)
7979
kryo.register(classOf[HttpBroadcast[_]], new KryoJavaSerializer())
8080

8181
// Allow the user to register their own classes by setting spark.kryo.registrator
82-
try {
83-
for (regCls <- registrator) {
84-
logDebug("Running user registrator: " + regCls)
82+
for (regCls <- registrator) {
83+
logDebug("Running user registrator: " + regCls)
84+
try {
8585
val reg = Class.forName(regCls, true, classLoader).newInstance()
8686
.asInstanceOf[KryoRegistrator]
8787
reg.registerClasses(kryo)
88+
} catch {
89+
case e: Exception =>
90+
throw new SparkException(s"Failed to invoke $regCls", e)
8891
}
89-
} catch {
90-
case e: Exception => throw
91-
new SparkException("Failed to run spark.kryo.registrator", e)
9292
}
9393

9494
// Register Chill's classes; we do this after our ranges and the user's own classes to let

0 commit comments

Comments
 (0)