eclipsesource / eclipsesource/J2V8

Exception thrown is not reported/captured

Open
#296 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.6k
Forks
387
PR merge metrics
No merged PRs in 30d

Description

When a method from Java throws an exception called from the javascript object, I can not seem to capture the exception (the exception is not printing any stack trace either). The only way I can capture the exception is to put a try/catch in the method that will throw the exception.

```
public void register() {
V8Object object = new V8Object(engine);
for (Method method : getClass().getMethods()) {
if (method.getAnnotation(Bind.class) != null) {
// Would be nice if I can attach some type of ExceptionHandler
object.registerJavaMethod(this, method.getName(), method.getName(), method.getParameterTypes());
}
}
engine.add("JAVA", object);
}

@Bind public void method() { // if I put try/catch here I can capture the exception
if (true) throw new RunetimeException();
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.