private Object checkResult(final Object result) { if (result == null) { return result; } if (result instanceof Float) { return ((Float) result).doubleValue(); } if ((result instanceof Integer) || (result instanceof Double) || (result instanceof Boolean) || (result instanceof String)) { return result; } if (result instanceof V8Value) { if (((V8Value) result).isReleased()) { throw new V8RuntimeException("V8Value already released"); } return result; } throw new V8RuntimeException("Unknown return type: " + result.getClass()); }
@Test public void testExecutionExceptionWithUnicode() { try { v8.executeVoidScript("throw('🌞')"); } catch (V8RuntimeException e) { assertTrue(e.toString().contains("throw('🌞")); } }
private Object checkResult(final Object result) { if (result == null) { return result; } if (result instanceof Float) { return ((Float) result).doubleValue(); } if ((result instanceof Integer) || (result instanceof Double) || (result instanceof Boolean) || (result instanceof String)) { return result; } if (result instanceof V8Value) { if (((V8Value) result).isReleased()) { throw new V8RuntimeException("V8Value already released"); } return result; } throw new V8RuntimeException("Unknown return type: " + result.getClass()); }
private Object checkResult(final Object result) { if (result == null) { return result; } if (result instanceof Float) { return ((Float) result).doubleValue(); } if ((result instanceof Integer) || (result instanceof Double) || (result instanceof Boolean) || (result instanceof String)) { return result; } if (result instanceof V8Value) { if (((V8Value) result).isReleased()) { throw new V8RuntimeException("V8Value already released"); } return result; } throw new V8RuntimeException("Unknown return type: " + result.getClass()); }
private Object checkResult(final Object result) { if (result == null) { return result; } if (result instanceof Float) { return ((Float) result).doubleValue(); } if ((result instanceof Integer) || (result instanceof Double) || (result instanceof Boolean) || (result instanceof String)) { return result; } if (result instanceof V8Value) { if (((V8Value) result).isReleased()) { throw new V8RuntimeException("V8Value already released"); } return result; } throw new V8RuntimeException("Unknown return type: " + result.getClass()); }