add more debug logging to Scheduler
[org.ibex.core.git] / src / org / ibex / Scheduler.java
index ec8253c..09487bd 100644 (file)
@@ -13,7 +13,7 @@ public class Scheduler {
 
     private static Scheduler singleton;
     public static interface Task { public abstract void perform() throws IOException, JSExn; }
-    public static void add(Task t) { Scheduler.runnable.append(t); }
+    public static void add(Task t) { Log.debug(Scheduler.class, "scheduling " + t); Scheduler.runnable.append(t); }
     public static void init() { if (singleton == null) (singleton = Platform.getScheduler()).run(); }
 
     private static Task current = null;
@@ -74,16 +74,18 @@ public class Scheduler {
                             s._mousey = s.mousey;
                         }
                     }
+                    Log.debug(Scheduler.class, "performing " + current);
                     current.perform();
                 }
                 renderAll();
             } catch (JSExn e) {
                 Log.info(Scheduler.class, "a JavaScript thread spawned with ibex.thread() threw an exception:");
-                Log.info(Scheduler.class, "JS Exception: " + e.getObject() + "\n" + e.backtrace());
                 Log.info(Scheduler.class,e);
             } catch (Exception e) {
                 Log.info(Scheduler.class, "a Task threw an exception which was caught by the scheduler:");
                 Log.info(Scheduler.class, e);
+            } catch (Throwable t) {
+                t.printStackTrace();
             }
             // if an Error is thrown it will cause the engine to quit
         }