Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(resource): check whether response matches action.isArray #3400

Closed
wants to merge 2 commits into from

Conversation

petebacondarwin
Copy link
Contributor

Replaces #3054

When using $resource you must setup your actions carefully based on what the server returns.
If the server responds to a request with an array then you must configure the action with
`isArray:true` and vice versa.  The built-in `get` action defaults to `isArray:false` and the
`query` action defaults to `isArray:true`, which is must be changed if the server does not do this.
Before the error message was an exception inside angular.copy, which didn't explain what the
real problem was. Rather than changing the way that angular.copy works, this change ensures that
a better error message is provided to the programmer if they do not set up their resource actions
correctly.

Closes angular#2255, angular#1044
@petebacondarwin
Copy link
Contributor Author

Passes the CI server: http://ci.angularjs.org/job/angular.js-pete/274/console

Normally $exceptionHandler doesn't throw an exception.  It is normally
used just for logging and so on.  But if an application developer
implemented a version that did throw an exception then $q would never
have called reject() when converting an exception thrown inside a `then`
handler into a rejected promise.
@petebacondarwin
Copy link
Contributor Author

Merged as a644ca7 ... 664526d

@petebacondarwin petebacondarwin deleted the pr3054 branch November 7, 2013 11:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant