Git Product home page Git Product logo

Comments (6)

benkonrath avatar benkonrath commented on July 4, 2024

Thanks for the bug report. There's definitely some inconsistency in our implementation and the comment in this adapter.

I looked at the active model adapter and it also returns the jqXHR instead of the an Error in this case (Error(jsonErrors['detail']);).

https://github.com/emberjs/data/blob/48c02654e8a524b390d1a28975416ee73f912d9e/packages/activemodel-adapter/lib/system/active_model_adapter.js#L124

I chose to parse the error that Django Rest Framework provides because I thought it would be more useful than returning the jqHXR. I'm definitely open to changing this but I just want to understand how this is normally used in Ember applications. Can you provide an example of something that you can't do with the current implementation? Or an example that shows the returning the jqXHR is better? Thanks.

from ember-django-adapter.

rafalp avatar rafalp commented on July 4, 2024

Can you provide an example of something that you can't do with the current implementation?

For startes I can't do what guide tells me I should be able to do:
http://emberjs.com/guides/routing/loading-and-error-substates/

Resources on ember.js forums show me that I should be able to do so:
http://discuss.emberjs.com/t/how-to-deal-with-route-when-model-gets-a-404/5283/2

I want to look into error within my ApplicationRouter error handler and thus make call between error404 page that will have search field, common links and suggestions about why user can't reach page, and error 403 that will actually display error message from server. There is also special kind of error 403 that happens when user is banned. In this case ban details are added to error JSON and I can notice that within 403 handling and render errror-banned template that will display this JSON.

Finally there is also special 0 status code which I would love to redirect to error 0 page explaining user that server connection has been lost.

from ember-django-adapter.

benkonrath avatar benkonrath commented on July 4, 2024

Ok, I'll fix this. Thanks for the information.

from ember-django-adapter.

rafalp avatar rafalp commented on July 4, 2024

👍 good man, thanks for working on this!

from ember-django-adapter.

benkonrath avatar benkonrath commented on July 4, 2024

@rafalp Can you review the code and try out the fix in #62 to see if it's going to work for you? Thanks.

from ember-django-adapter.

rafalp avatar rafalp commented on July 4, 2024

Yep, my Ember.js ApplicationRoute's error hook can now access error status and whole message. There's also error.status so 👍

from ember-django-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.