diff --git a/src/ng/templateRequest.js b/src/ng/templateRequest.js index 4d3989ce4904..249e81ec4ee3 100644 --- a/src/ng/templateRequest.js +++ b/src/ng/templateRequest.js @@ -49,7 +49,8 @@ function $TemplateRequestProvider() { function handleError(resp) { self.totalPendingRequests--; if (!ignoreRequestError) { - throw $compileMinErr('tpload', 'Failed to load template: {0}', tpl); + throw $compileMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})', + tpl, resp.status, resp.statusText); } return $q.reject(resp); } diff --git a/test/ng/templateRequestSpec.js b/test/ng/templateRequestSpec.js index 2b695d6ab300..684399ccf050 100644 --- a/test/ng/templateRequestSpec.js +++ b/test/ng/templateRequestSpec.js @@ -39,7 +39,7 @@ describe('$templateRequest', function() { it('should throw an error when the template is not found', inject(function($rootScope, $templateRequest, $httpBackend) { - $httpBackend.expectGET('tpl.html').respond(404); + $httpBackend.expectGET('tpl.html').respond(404, '', {}, 'Not found'); $templateRequest('tpl.html'); @@ -48,7 +48,7 @@ describe('$templateRequest', function() { expect(function() { $rootScope.$digest(); $httpBackend.flush(); - }).toThrowMinErr('$compile', 'tpload', 'Failed to load template: tpl.html'); + }).toThrowMinErr('$compile', 'tpload', 'Failed to load template: tpl.html (HTTP status: 404 Not found)'); })); it('should not throw when the template is not found and ignoreRequestError is true',