Skip to content

Commit 291ee0a

Browse files
committed
PApplet: Add log
Signed-off-by: Ce Gao <[email protected]>
1 parent 1dd58ff commit 291ee0a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/rprocessing/RLangPApplet.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import javax.script.ScriptEngine;
1313
import javax.script.ScriptEngineManager;
14-
import javax.script.ScriptException;
1514

1615
import org.renjin.eval.EvalException;
1716
import org.renjin.parser.RParser;
@@ -259,6 +258,7 @@ public void start() {
259258
public void uncaughtException(final Thread t, final Throwable e) {
260259
terminalException = toSketchException(e);
261260
try {
261+
log("There is an unexpected exception.");
262262
handleMethods("dispose");
263263
} catch (final Exception noop) {
264264
// give up
@@ -295,8 +295,11 @@ public void setup() {
295295
wrapProcessingVariables();
296296
if (this.mode == Mode.STATIC) {
297297
try {
298+
log("The mode is static, run the program directly.");
298299
this.renjinEngine.eval(this.programText);
299-
} catch (ScriptException exception) {
300+
log("Evaluate the code in static mode.");
301+
} catch (final Exception exception) {
302+
log("There is exception when evaluate the code in static mode.");
300303
terminalException = toSketchException(exception);
301304
exitActual();
302305
}
@@ -308,6 +311,7 @@ public void setup() {
308311
} else {
309312
System.out.println("The program is in mix mode now.");
310313
}
314+
log("Setup done");
311315
}
312316

313317
/**
@@ -388,6 +392,10 @@ private static RSketchError toSketchException(Throwable t) {
388392
final RSketchError e = (RSketchError) t;
389393
return e;
390394
}
395+
if (t instanceof ClassCastException) {
396+
final RSketchError e = (RSketchError) t;
397+
return e;
398+
}
391399
log("No exception type detected.");
392400
return null;
393401
}

0 commit comments

Comments
 (0)