public boolean catchUncaught(Exception e) { return catchUncaught(e, false); }
public void wrapThrow(Throwable throwable) { if (throwable instanceof Exception) { catchUncaught((Exception) throwable); } else { throw new RuntimeException(throwable); } }
@Override public void run() { try { invoker.callAny(this); } catch (Exception e) { env.catchUncaught(e); } } };
@Override public void run() { try { invoker.callAny(this); } catch (Exception e) { env.catchUncaught(e); } } };
public Memory invokeMethodNoThrow(IObject object, String name, Memory... args) { try { return invokeMethod(object, name, args); } catch (RuntimeException e) { throw e; } catch (Exception e) { this.catchUncaught(e); return Memory.NULL; } catch (Throwable e) { throw new RuntimeException(e); } }
public Memory includeNoThrow(Environment env, ArrayMemory locals){ try { return include(env, locals); } catch (DieException | ErrorException e) { throw e; } catch (Exception e) { env.catchUncaught(e); return Memory.NULL; } catch (Throwable throwable) { throw new RuntimeException(throwable); } }
public void doFinal() throws Throwable { for (ShutdownHandler handler : shutdownFunctions) { try { handler.call(); } catch (DieException e) { finalizeObjects(); catchUncaught(e); break; } catch (BaseBaseException | ErrorException e) { catchUncaught(e); break; } catch (Exception e) { catchUncaught(e); break; } } finalizeObjects(); flushAll(); lastMessage = null; }
@Override public Object eval(ScriptContext context) throws ScriptException { try { try { return module.include(environment); } catch (Exception e) { environment.catchUncaught(e); } catch (Throwable throwable) { throw new RuntimeException(throwable); } finally { try { environment.doFinal(); } catch (Throwable throwable) { throw new RuntimeException(throwable); } } } catch (Throwable e) { throw new ScriptException(new Exception(e)); } return null; }
public boolean catchUncaught(UncaughtException e) { if (exceptionHandler != null) { try { if (!(e.getException() instanceof FinallyException)) { exceptionHandler.onException(this, e.getException()); } } catch (BaseBaseException _e) { catchUncaught(_e); } catch (Throwable throwable) { throw new RuntimeException(throwable); } return true; } else return false; }
@Override public void reset() { currentKey = Memory.CONST_INT_M1; env.pushCall(stream, "seek", Memory.CONST_INT_0); try { stream.seek(env, Memory.CONST_INT_0); } catch (IOException e) { env.catchUncaught(e); } finally { env.popCall(); } } }));
public void initEnvironment(Environment env) { if (isClass() && nativeInitEnvironment != null) { try { nativeInitEnvironment.invoke(null, env); } catch (InvocationTargetException e) { env.__throwException(e); } catch (IllegalAccessException e) { throw new CriticalException(e); } } if (!traits.isEmpty()) { Set<ClassEntity> used = new HashSet<ClassEntity>(); try { for (ClassEntity trait : traits.values()) { trait.initTraitEnvironment(env, this, used); } } catch (Exception e) { env.catchUncaught(e); } catch (Throwable e) { throw new CriticalException(e); } } }
public static void catchThrowable(Throwable e, Environment environment) { if (e instanceof BaseBaseException) { BaseBaseException baseException = (BaseBaseException) e; baseException.getEnvironment().catchUncaught(baseException); return; } else if (e instanceof Exception) { Environment env = environment == null ? null : environment; if (env != null) { try { env.catchUncaught((Exception) e); } catch (RuntimeException e2) { if (env.getDefaultBuffer() == null || env.getDefaultBuffer().getOutput() == null) { e2.printStackTrace(); } else { e2.getCause().printStackTrace(new PrintStream(env.getDefaultBuffer().getOutput())); } } return; } } Environment env = environment == null ? null : environment; if (env != null) { e.printStackTrace(new PrintStream(env.getDefaultBuffer().getOutput())); } else { e.printStackTrace(); } }
@Override public void run() { try { if (trigger.callAny(this).toBoolean()) { this.cancel(); invoker.callAny(this); } } catch (Exception e) { env.catchUncaught(e); } } };
private Callable<Memory> makeCallable(Environment env, Invoker invoker) { return () -> { try { Environment.addThreadSupport(env); return invoker.call(); } catch (Exception throwable) { if (throwable instanceof CriticalException) { throwable.printStackTrace(); } if (throwable instanceof CustomErrorException) { CustomErrorException error = (CustomErrorException) throwable; env.error(error.getType(), error.getMessage()); } else { env.catchUncaught(throwable); } return Memory.NULL; } catch (Throwable throwable) { env.wrapThrow(throwable); return Memory.NULL; } }; }
public boolean catchUncaught(Exception e, boolean retry) { if (e instanceof UncaughtException) return catchUncaught((UncaughtException) e); else if (e instanceof DieException) { System.exit(((DieException) e).getExitCode()); throw new RuntimeException(_e); } else { catchUncaught(_e, true);
@Override protected boolean nextValue() { if (eof()) return false; env.pushCall(stream, "read", LongMemory.valueOf(chunkSize)); try { currentValue = stream.read(env, LongMemory.valueOf(chunkSize)); currentKey = ((LongMemory) currentKey).inc(); } catch (IOException e) { env.catchUncaught(e); } finally { env.popCall(); } return true; }
environment.catchUncaught(e); } catch (Throwable throwable) { throw new RuntimeException(throwable);