-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model does not exist (http 404 not found) #296
Comments
In my #298 PR I propose to pass record instance to find method, this way we could pass it along to error handeling code |
@pjlammertyn, @tchak I suspect this has been resolved in master. Can you verify? |
definitely not solved. We have no error handeling at all. |
I was wondering what the current thinking about error handling on find is, when receiving a 404 or 403 response for example. Some error handling on create and update has been added in #476 but there is no handling at all on find. I tried implementing the suggestion @tchak made above of passing a record to the adapter find method. Reusing the existing error handling code in the adapter sends a I'm just getting started with Ember, so I only understand bits and pieces of the architecture, but I was expecting a transition from the loading route to the failure route. Does that make sense? What can I do to make that work? |
Thinking about this some more, there doesn't seem to be a way to indicate an error state for a RecordArray at all. So how should errors on find methods that return more than one record be handled? |
This is really bad news. I mean 404s can happen all the time, ember-data is almost useless without handling 404s (I would know, I just ran into this issue and have NO idea how to solve it). |
@stephanos we are aware of this shortcoming. The current plan is: https://gist.github.com/stefanpenner/9ccb0503e451a9792ed0 |
thank you for the update, I appreciate it |
@stephanos yes this is annoying, I have a branch of ember-data that abrasively forces this to work. I'll try to get a less janky solution in ASAP. |
Any updates on this? No error handling on .find() is killing me. |
+1 Really need this. Currently don't have a good way of handling it when users go to a mistyped URL with a dynamic segment ID and the model can't be found |
@stefanpenner what's the latest thinking on this? With the new router facelift, it'd be really great if we could push forward on improving the promise support in ember data. There was some good discussion on discourse, but that seems to have stagnated. #1046 is also relevant here, but probably isn't a long-term solution imo. |
@jasonkriss #1046 is a playground for now. A better solution long term is probably to always return promises from |
@tchak Yep, I'm with you. Thanks a lot for putting it out there. It's definitely helpful, as is all the rest of promise work you've done. Much appreciated. |
@jasonkriss this is a sum of my current ideas https://gist.github.com/tchak/5875101 |
I'll 👍 this. I attempted to add an error event per some of the solutions in this SO post but the event never fired for my route. |
Wouldn't the error event on the router only be fired if the promise from a model() call (in this case, an ember-data record) rejects? I'd like some way to respond whenever the server can't find() a record. |
@pharcosyle this is part of a larger issue, we currently mix the models promise and the operation that retrieves it, this leads to many issues. We have a plan and early spec'd out proposal for dealing with these scenarios across ember. Expect something on discuss.emberjs.com soon. |
@stefanpenner gotcha, I'll keep an eye out! |
This should be solved now. |
I'm experiencing this issue with 1.0.0-beta.16.1 |
Could you submit a failing jsbin or a test case? You can find starting jsbins in https://github.com/emberjs/data/blob/master/CONTRIBUTING.md |
Here's the JS Bin : If you click on Inspect Authors after trying to access Arthur C. Clarke you'll see that the record is in the store even though the adapter returned a 404. |
@jdurand I think this is related to #3013 (comment) |
@pangratz Yep, seems spot on. Thanks for linking! |
if you try to find an object by id
and the rest server returns a 404 not found, the model remains in the loading state.
It would be better if goes to an error state.
a solution is to extend the rest_adapter
any suggestions?
The text was updated successfully, but these errors were encountered: