@Prabhakar wrote:
I have a typical scenario. My model hook for Route-1 looks something like this.
model() { return Ember.RSVP.hash({ allProjects: this.store.findAll('post'), allUsers: this.store.findAll('author') }); }
If I'm on Route-2 and navigate to Route-1 it will call the model hook. And if I already have data on my store, both the findAll requests are resolved, triggering RSVP.hash to resolve.
But if the request fails, I'm getting undefined error in my console (chrome).(twice for each of findAll) My error tracking system reports it as Unhandled promise error detected
the stack shows no relevant info either
defaultDispatch @ ember.debug.js:18008 dispatchError @ ember.debug.js:17987 onerrorDefault @ ember.debug.js:31634 trigger @ ember.debug.js:58713 (anonymous) @ ember.debug.js:59614 invokeWithOnError @ ember.debug.js:346 flush @ ember.debug.js:405 flush @ ember.debug.js:529 end @ ember.debug.js:599 (anonymous) @ ember.debug.js:1165
There is not much help from the stack trace. My adapter hooks returns successfully. And then there is error in my console. I am not able to figure out what is causing the error to be thrown because the promise findAll already got resolved. And ember tells me I have not handled the promise!
I tried putting catch/reject codes everywher but it never gets called. Because of course the promise was already resolved. So, it can not be rejected.
Then where is this error coming from!! I have no clue. The only thing I could find was, my serializer does not get called when the error arises. So, probably the error is thrown before
ember-data
callsnormalizeFindAllResponse
.The only thing I could find was in my serializer normalizeFindAllResponse was not invoked whenever such failures happened.
Any help is greatly appreciated. Thanks!
Posts: 4
Participants: 2