Skip to content

Instantly share code, notes, and snippets.

@forcementor
Created October 17, 2012 21:36
Show Gist options
  • Select an option

  • Save forcementor/3908402 to your computer and use it in GitHub Desktop.

Select an option

Save forcementor/3908402 to your computer and use it in GitHub Desktop.
Developing Mobile…Force.com and Sencha-Part 2, Step 8: Adjusting the Model and Adding a Data Proxy - Controller Init stub
init: function () {
this.callParent(arguments);
console.log("init");
//Listen for exceptions observed by the proxy so we can report them and clean up.
//20121016 Fixed for bug on improper object references
Ext.getStore('Leads').getProxy().addListener('exception', function (proxy, response, operation, options) {
// only certain kinds of errors seem to have useful information returned from the server
if (response) {
if (response.errorMessage) {
Ext.Msg.alert('Error', response.errorMessage);
} else {
Ext.Msg.alert('Error', operation.config.action + ' failed: ' + response.errorMessage);
}
} else {
Ext.Msg.alert('Error', operation.config.action + ' failed for an unknown reason: proxy = ' + proxy);
}
});
},
@forcementor

Copy link
Copy Markdown
Author

Fixed for bug on improper object references, now properly displays error messages passed back from the Apex controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment