spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pwend...@apache.org
Subject git commit: [SPARK-3836] [REPL] Spark REPL optionally propagate internal exceptions
Date Wed, 08 Oct 2014 05:32:44 GMT
Repository: spark
Updated Branches:
  refs/heads/master 798ed22c2 -> c7818434f


[SPARK-3836] [REPL] Spark REPL optionally propagate internal exceptions

Optionally have the repl throw exceptions generated by interpreted code, instead of swallowing
the exception and returning it as text output. This is useful when embedding the repl, otherwise
it's not possible to know when user code threw an exception.

Author: Ahir Reddy <ahirreddy@gmail.com>

Closes #2695 from ahirreddy/repl-throw-exceptions and squashes the following commits:

bad25ee [Ahir Reddy] Style Fixes
f0e5b44 [Ahir Reddy] Fixed style
0d4413d [Ahir Reddy] propogate excetions from repl


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c7818434
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c7818434
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c7818434

Branch: refs/heads/master
Commit: c7818434fa8ae8e02a0d66183990077a4ba1436c
Parents: 798ed22
Author: Ahir Reddy <ahirreddy@gmail.com>
Authored: Tue Oct 7 22:32:39 2014 -0700
Committer: Patrick Wendell <pwendell@gmail.com>
Committed: Tue Oct 7 22:32:39 2014 -0700

----------------------------------------------------------------------
 .../main/scala/org/apache/spark/repl/SparkIMain.scala   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/c7818434/repl/src/main/scala/org/apache/spark/repl/SparkIMain.scala
----------------------------------------------------------------------
diff --git a/repl/src/main/scala/org/apache/spark/repl/SparkIMain.scala b/repl/src/main/scala/org/apache/spark/repl/SparkIMain.scala
index 6ddb6ac..646c68e 100644
--- a/repl/src/main/scala/org/apache/spark/repl/SparkIMain.scala
+++ b/repl/src/main/scala/org/apache/spark/repl/SparkIMain.scala
@@ -84,9 +84,11 @@ import org.apache.spark.util.Utils
    *  @author Moez A. Abdel-Gawad
    *  @author Lex Spoon
    */
-  class SparkIMain(initialSettings: Settings, val out: JPrintWriter)
-      extends SparkImports with Logging {
-    imain =>
+  class SparkIMain(
+      initialSettings: Settings,
+      val out: JPrintWriter,
+      propagateExceptions: Boolean = false)
+    extends SparkImports with Logging { imain =>
 
     val conf = new SparkConf()
 
@@ -816,6 +818,10 @@ import org.apache.spark.util.Utils
     val resultName  = FixedSessionNames.resultName
 
     def bindError(t: Throwable) = {
+      // Immediately throw the exception if we are asked to propagate them
+      if (propagateExceptions) {
+        throw unwrap(t)
+      }
       if (!bindExceptions) // avoid looping if already binding
         throw t
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message