getoutreach / epf

A framework for keeping your Ember.js apps in sync.
http://epf.io
MIT License
369 stars 33 forks source link

how to handle server error 500 on Model.find? #134

Open ghost opened 10 years ago

ghost commented 10 years ago

I'm trying to handle error 500 failures and I can't figure out how to prevent the rest adapter from choking. I've extended the PayloadSerializer to check the status code on the xhr and return something different if the code is 500, but I have no idea what to return to keep from hitting an internal assertion. Ideally, I'd just handle it in $(document).ajaxError, but the request never seems to bubble up to there.

Instead, execution just stops with this stack trace:

GET http://localhost:3000/slots 500 (Internal Server Error) jquery.js?body=1:9667
Error: Assertion Failed: Cannot call get with 'typeKey' on an undefined object.
    at new Error (native)
    at Error.Ember.Error (http://localhost:3000/assets/ember.js?body=1:911:19)
    at Object.Ember.assert (http://localhost:3000/assets/ember.js?body=1:74:11)
    at get (http://localhost:3000/assets/ember.js?body=1:2169:9)
    at require.define.Ep.IdManager.Ember.Object.extend._generateClientId (http://localhost:3000/assets/epf_a06b0350.js?body=1:4241:16)
    at require.define.Ep.IdManager.Ember.Object.extend.reifyClientId (http://localhost:3000/assets/epf_a06b0350.js?body=1:4229:29)
    at require.define.Ep.Session.Ember.Object.extend.reifyClientId (http://localhost:3000/assets/epf_a06b0350.js?body=1:2095:24)
    at require.define.Ep.Session.reopen.merge (http://localhost:3000/assets/epf_a06b0350.js?body=1:1767:14)
    at merge (http://localhost:3000/assets/epf_a06b0350.js?body=1:280:28)
    at http://localhost:3000/assets/epf_a06b0350.js?body=1:286:17 ember.js?body=1:3522
Uncaught Error: Assertion Failed: Error: Assertion Failed: Cannot call get with 'typeKey' on an undefined object. ember.js?body=1:74

Any hints about what I can return would be very welcome. Thanks.