Titanium JIRA Archive
Alloy (ALOY)

[ALOY-932] Improve error messages when attempting to bind to complex objects

GitHub Issuen/a
Resolution Date2014-07-23T15:27:46.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.5.0
ComponentsModels, XML
ReporterAlan Wamser
AssigneeFeon Sua Xin Miao


When attempting to bind to a complex object, such as the following, the resulting error messages are not clear and meaningful.
<TableView dataCollection="provider">
    <TableViewRow id="row" onClick="doViewDetails">
        <ImageView id="rowImage" image="{photo.urls.square_75}" />
        <Label id="rowFirstName" text="{first_name}" />
        <Label id="rowLastName" text="{last_name}" />
Generates: "'undefined' is not an object (evaluating 'Alloy.Models.photo.on')"; Which doesn't clearly identify the problem being the attempt to reference the deep object reference photo.urls.square_75. As pointed out in the original source of this ticket (http://developer.appcelerator.com/question/161740/alloymodelsphotoon#answer-274198), the solution is to map the object property to an attribute of the model, which could be done by extending the model or collection. Error message could possibly point developers to this solution.


  1. Feon Sua Xin Miao 2014-07-21

    PR: https://github.com/appcelerator/alloy/pull/488 Test app: https://github.com/feons/alloy/tree/ALOY-932/test/apps/testing/ALOY-932 Functional Test: Run the test app, Alloy compilation should fail with an error message identify the problem that the developer is trying to bind to a complex object.
  2. Tim Poulsen 2014-07-23

    PR merged
  3. Federico Casali 2014-08-14

    Verified returning the expected error message, building for Android, iOS and MobileWeb, both from Appcelerator Studio and CLI:
       [INFO] :   ----- MVC GENERATION -----
       [INFO] :   [global style] writing to cache...
       [INFO] :   [models/fruits.js] model processing...
       [INFO] :   [index.xml] view processing...
       [INFO] :   style:      "index.tss"
       [INFO] :   view:       "index.xml"
       [ERROR] :  Attempt to reference the deep object reference : "name.color".
       [ERROR] :  Instead, please map the object property to an attribute of the model.
       [ERROR] :  Alloy compiler failed
    TCMS Test added. TiSDK 3.4.0.v20140813022514 Appcelerator Studio CLI 3.4.0-dev Alloy 1.5.0-dev Xcode6-beta5 Closing.

JSON Source