[TIMOB-25523] Hyperloop: Android - Add support to catch typed exceptions
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Hyperloop 3.0.0 |
Fix Version/s | n/a |
Components | Android, Hyperloop |
Labels | n/a |
Reporter | Jan Vennemann |
Assignee | Jan Vennemann |
Created | 2017-11-16T15:24:24.000+0000 |
Updated | 2018-03-28T18:48:05.000+0000 |
Description
With TIMOB-24657 we allowed exceptions to bubble up to JS so they can be utilized in try-catch-blocks. All exception will be converted to strings though, so there cannot be done any type checking against the exception class, which is crucial in Java. The following approach solves this issue:
* Throw a special
HyperloopException
from Java based on a catched InvocationTargetException
.
* Handle those exception in https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/v8/src/native/JSException.cpp#L37. Get the original exception via getCause()
and construct a HyperloopNativeExceptionError
in JS which allows the developer to access the underlying native Exception
No comments