Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10530] Android: Java exceptions should be converted and thrown as JS exceptions.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-08-21T15:06:50.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsAndroid
Labelscore
ReporterJosh Roesslein
AssigneeJosh Roesslein
Created2012-08-21T14:40:20.000+0000
Updated2014-06-19T12:44:39.000+0000

Description

When making a JS call that binds to a Java method and an exception is thrown we should catch it in Kroll and convert it into a JS exception. This can allow developers to handle them more gracefully and also pinpoints where in the JS code the crash originated. Having both a JS and Java trace would be valuable in debugging platform bugs reported by our developers. This also allows us to throw exception due to invalid calls. For example if the developer calls View.add() passing a non-view we can throw an exception. This provides a trace to the point of the error so the developer does not need to hunt for the bad JS call site.

Comments

  1. Josh Roesslein 2012-08-21

    Parity should also be considered on how we handle invalid method calls due to developer errors. Any intentional exceptions thrown should be consistent across all platforms. Exception specific to Android internals (ex: null pointer) can be an exception.
  2. Josh Roesslein 2012-08-21

    My bad this actually working fine for sync based calls. The case I was seeing was due to the exception getting thrown async on the UI thread. :\

JSON Source