Ejemplo n.º 1
0
 private void errorReporter(ExecutionContext cx, Throwable throwable) {
   try {
     throw throwable;
   } catch (StopExecutionException e) {
     if (e.getReason() == Reason.Quit) {
       System.exit(0);
     }
   } catch (ScriptException e) {
     handleException(cx.getRealm(), e);
   } catch (UnhandledRejectionException e) {
     handleException(cx.getRealm(), e);
   } catch (StackOverflowError e) {
     handleException(cx.getRealm(), e);
   } catch (OutOfMemoryError e) {
     handleException(cx.getRealm(), e);
   } catch (InternalException e) {
     handleException(e);
   } catch (BootstrapMethodError e) {
     handleException(e.getCause());
   } catch (UncheckedIOException e) {
     handleException(e.getCause());
   } catch (Throwable e) {
     printStackTrace(System.err, e, options.stacktraceDepth);
     System.exit(1);
   }
 }
Ejemplo n.º 2
0
 /** REPL: Loop */
 private void loop() throws InterruptedException {
   Realm realm = newRealm();
   World world = realm.getWorld();
   TaskSource taskSource = createTaskSource(realm);
   for (; ; ) {
     try {
       world.runEventLoop(taskSource);
       return;
     } catch (StopExecutionException e) {
       if (e.getReason() == Reason.Quit) {
         System.exit(0);
       }
     } catch (ParserExceptionWithSource e) {
       handleException(e);
     } catch (ScriptException e) {
       handleException(realm, e);
     } catch (UnhandledRejectionException e) {
       handleException(realm, e);
     } catch (StackOverflowError e) {
       handleException(realm, e);
     } catch (OutOfMemoryError e) {
       handleException(realm, e);
     } catch (InternalException e) {
       handleException(e);
     } catch (BootstrapMethodError e) {
       handleException(e.getCause());
     } catch (UncheckedIOException e) {
       handleException(e.getCause());
     }
   }
 }