mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-13 08:59:54 +08:00
fix(ngResource): make badcfg error message more helpful
The error message should help identify the problem. To do so, more details need to be provided. Closes #9005 Closes #9010
This commit is contained in:
@@ -579,9 +579,8 @@ angular.module('ngResource', ['ng']).
|
||||
// jshint -W018
|
||||
if (angular.isArray(data) !== (!!action.isArray)) {
|
||||
throw $resourceMinErr('badcfg',
|
||||
'Error in resource configuration. Expected ' +
|
||||
'response to contain an {0} but got an {1}',
|
||||
action.isArray ? 'array' : 'object',
|
||||
'Error in resource configuration for action `{0}`. Expected response to ' +
|
||||
'contain an {1} but got an {2}', name, action.isArray ? 'array' : 'object',
|
||||
angular.isArray(data) ? 'array' : 'object');
|
||||
}
|
||||
// jshint +W018
|
||||
|
||||
@@ -1320,7 +1320,7 @@ describe('resource', function() {
|
||||
expect(successSpy).not.toHaveBeenCalled();
|
||||
expect(failureSpy).toHaveBeenCalled();
|
||||
expect(failureSpy.mostRecentCall.args[0]).toMatch(
|
||||
/^\[\$resource:badcfg\] Error in resource configuration\. Expected response to contain an array but got an object/
|
||||
/^\[\$resource:badcfg\] Error in resource configuration for action `query`\. Expected response to contain an array but got an object/
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1337,7 +1337,7 @@ describe('resource', function() {
|
||||
expect(successSpy).not.toHaveBeenCalled();
|
||||
expect(failureSpy).toHaveBeenCalled();
|
||||
expect(failureSpy.mostRecentCall.args[0]).toMatch(
|
||||
/^\[\$resource:badcfg\] Error in resource configuration. Expected response to contain an object but got an array/
|
||||
/^\[\$resource:badcfg\] Error in resource configuration for action `get`\. Expected response to contain an object but got an array/
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user