[ALOY-932] Improve error messages when attempting to bind to complex objects
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-07-23T15:27:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.5.0 |
Components | Models, XML |
Labels | qe-manualtest |
Reporter | Alan Wamser |
Assignee | Feon Sua Xin Miao |
Created | 2014-01-21T14:45:54.000+0000 |
Updated | 2014-08-14T01:07:21.000+0000 |
Description
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}" />
</TableViewRow>
</TableView>
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.
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.
PR merged
Verified returning the expected error message, building for Android, iOS and MobileWeb, both from Appcelerator Studio and CLI:
TCMS Test added. TiSDK 3.4.0.v20140813022514 Appcelerator Studio 3.3.1.201408121314 CLI 3.4.0-dev Alloy 1.5.0-dev Xcode6-beta5 Closing.