ember-model icon indicating copy to clipboard operation
ember-model copied to clipboard

records.reload() callback doesn't allow the detection of an error

Open hypexr opened this issue 10 years ago • 0 comments

I have an issue where I not able to detect that a query failed with a response code of 404:

stores.then(function(records) {
        Em.Logger.log("In stores then");
        Em.Logger.log(records);
        records.reload().then(function(records2) {
            Em.Logger.log("In records.reload() then");
            Em.Logger.log(records2);
        }, function(stu2) {
            Em.Logger.log("In records.reload() failed");
        });
    }, function(err) {
        Em.Logger.log("In stores error");
        Em.Logger.log(err);
    });
});

The console output from this query is:

In stores then
In records.reload() then

I would expect that I could handle the 404 in either the second function passed to stores.then or in a second function passed to reload().then, but it looks like reload.then doesn't take a function to handle errors.

hypexr avatar Jun 30 '14 19:06 hypexr