Skip to content
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

Throw a more helpful error message if the response from queryRecord i… #3864

Merged
merged 1 commit into from
Dec 11, 2015

Conversation

bmac
Copy link
Member

@bmac bmac commented Oct 16, 2015

…s empty

@@ -175,6 +175,7 @@ export function _queryRecord(adapter, store, typeClass, query) {
var record;
store._adapterRun(function() {
var payload = normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, 'queryRecord');
Ember.assert('`store.queryRecord` expected the adapter to return one record but the response from the adapter was empty.', payload.data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this assert that payload.data is an object, not just truthy?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm.

@bmac
Copy link
Member Author

bmac commented Dec 3, 2015

Igor and I looked at this again and we released its not clear where in the stack to reject a missing findQuery response when there is no information form the protocol (like a 404) thus requiring you to inspect the payload to determine if there response is empty.

@bmac bmac removed the team-review label Dec 11, 2015
bmac added a commit that referenced this pull request Dec 11, 2015
Throw a more helpful error message if the response from queryRecord i…
@bmac bmac merged commit 2740417 into emberjs:master Dec 11, 2015
@bmac bmac deleted the better-error branch December 11, 2015 17:54
bmac added a commit to bmac/data that referenced this pull request Mar 21, 2016
The origial intent was for a queryRecord with no response to reject the promise so it would act like a `findRecord` with a 404. This change introduced a regression that broke existing apps so it is going to be reverted.

Closes emberjs#4219
bmac added a commit that referenced this pull request Mar 21, 2016
bmac added a commit that referenced this pull request Mar 22, 2016
The origial intent was for a queryRecord with no response to reject the promise so it would act like a `findRecord` with a 404. This change introduced a regression that broke existing apps so it is going to be reverted.

Closes #4219

(cherry picked from commit 274d7b1)
bmac added a commit that referenced this pull request Mar 22, 2016
The origial intent was for a queryRecord with no response to reject the promise so it would act like a `findRecord` with a 404. This change introduced a regression that broke existing apps so it is going to be reverted.

Closes #4219

(cherry picked from commit 274d7b1)
bmac added a commit that referenced this pull request Mar 22, 2016
The origial intent was for a queryRecord with no response to reject the promise so it would act like a `findRecord` with a 404. This change introduced a regression that broke existing apps so it is going to be reverted.

Closes #4219

(cherry picked from commit 274d7b1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants