I have a dijit.form.FilteringSelect using a dojo.store.JsonRest instance as the store.
My back end service for the store gets the data from somewhere else that requires authentication. Occasionally, this authentication might fail, and I’d like to report that to the browser.
The error that get returned is JSON and the response is 404, so I can see this logged in the console. However, I can’t seem to find a way to hook into that, so I can do something useful with it, either via the FilteringSelect instance, or via the JsonRest instance.
Given the following code, where can I add an error handler function?
var store = new JsonRest({
target: "/json/store/",
idProperty: "InternalID"
});
var widget = new FilteringSelect({
id: 'widgetId',
store: store,
searchAttr: 'name'
}, 'widgetId'
});
The version of Dojo being used is 1.7.3.
I ended up intercepting the QueryResults returned by the store.query, and created my own Deferred with an appropriate error handler. Similar to the FilteringSelect, I also had to trap for cancellations.
The resulting portion of code goes after the definition of the store, and before the FilteringSelect.