Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7db3b0f

Browse files
Jaco-Pretoriusnetman92
authored andcommittedAug 8, 2015
feat($resource): include request context in error message
include the request context (method & url) in badcfg error message Closes angular#11363
1 parent 776b030 commit 7db3b0f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/ngResource/resource.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ angular.module('ngResource', ['ng']).
583583
if (angular.isArray(data) !== (!!action.isArray)) {
584584
throw $resourceMinErr('badcfg',
585585
'Error in resource configuration for action `{0}`. Expected response to ' +
586-
'contain an {1} but got an {2}', name, action.isArray ? 'array' : 'object',
587-
angular.isArray(data) ? 'array' : 'object');
586+
'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object',
587+
angular.isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url);
588588
}
589589
// jshint +W018
590590
if (action.isArray) {

‎test/ngResource/resourceSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ describe('resource', function() {
13281328
expect(successSpy).not.toHaveBeenCalled();
13291329
expect(failureSpy).toHaveBeenCalled();
13301330
expect(failureSpy.mostRecentCall.args[0]).toMatch(
1331-
/^\[\$resource:badcfg\] Error in resource configuration for action `query`\. Expected response to contain an array but got an object/
1331+
/^\[\$resource:badcfg\] Error in resource configuration for action `query`\. Expected response to contain an array but got an object \(Request: GET \/Customer\/123\)/
13321332
);
13331333
});
13341334

@@ -1345,7 +1345,7 @@ describe('resource', function() {
13451345
expect(successSpy).not.toHaveBeenCalled();
13461346
expect(failureSpy).toHaveBeenCalled();
13471347
expect(failureSpy.mostRecentCall.args[0]).toMatch(
1348-
/^\[\$resource:badcfg\] Error in resource configuration for action `get`\. Expected response to contain an object but got an array/
1348+
/^\[\$resource:badcfg\] Error in resource configuration for action `get`\. Expected response to contain an object but got an array \(Request: GET \/Customer\/123\)/
13491349
);
13501350
});
13511351

0 commit comments

Comments
 (0)
Please sign in to comment.