Skip to content

Commit 9eb7d73

Browse files
author
Anatoly Ostrovsky
committed
Rethrow in exception handler
1 parent 478ea1b commit 9eb7d73

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

src/directive/include/include.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ ngIncludeDirective.$inject = [
1414
* @param {ng.TemplateRequestService} $templateRequest
1515
* @param {import("../../services/anchor-scroll/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
1616
* @param {ng.AnimateService} $animate
17-
* @param {import('../../services/exception/interface.ts').ErrorHandler} $exceptionHandler
18-
* @returns {import('../../interface.ts').Directive}
17+
* @param {ng.ExceptionHandlerService} $exceptionHandler
18+
* @returns {ng.Directive}
1919
*/
2020
export function ngIncludeDirective(
2121
$templateRequest,

src/directive/include/include.spec.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe("ngInclude", () => {
125125
it("should fire $includeContentRequested event on scope after making the xhr call", (done) => {
126126
let called = false;
127127

128-
window.angular.module("myModule", []).run(($rootScope) => {
128+
module.run(($rootScope) => {
129129
$rootScope.$on("$includeContentRequested", (event) => {
130130
called = true;
131131
});
@@ -166,7 +166,7 @@ describe("ngInclude", () => {
166166
const contentLoadedSpy = jasmine.createSpy("content loaded");
167167
const contentErrorSpy = jasmine.createSpy("content error");
168168

169-
window.angular.module("myModule", []).run(($rootScope) => {
169+
module.run(($rootScope) => {
170170
$rootScope.url = "/mock/401";
171171
$rootScope.$on("$includeContentLoaded", contentLoadedSpy);
172172
$rootScope.$on("$includeContentError", contentErrorSpy);
@@ -186,8 +186,6 @@ describe("ngInclude", () => {
186186
});
187187

188188
it("should evaluate onload expression when a partial is loaded", (done) => {
189-
window.angular.module("myModule", []);
190-
191189
element = createElementFromHTML(
192190
'<div><div><ng-include src="url" onload="loaded = true"></ng-include></div></div>',
193191
);
@@ -203,8 +201,6 @@ describe("ngInclude", () => {
203201
});
204202

205203
it("should create child scope and destroy old one", (done) => {
206-
window.angular.module("myModule", []);
207-
208204
element = createElementFromHTML(
209205
'<div><ng-include src="url"></ng-include></div>',
210206
);
@@ -240,7 +236,6 @@ describe("ngInclude", () => {
240236
});
241237

242238
it("should do xhr request and cache it", async () => {
243-
window.angular.module("myModule", []);
244239
element = createElementFromHTML(
245240
'<div><ng-include src="url"></ng-include></div>',
246241
);
@@ -260,7 +255,6 @@ describe("ngInclude", () => {
260255
});
261256

262257
it("should clear content when error during xhr request", async () => {
263-
window.angular.module("myModule", []);
264258
element = createElementFromHTML(
265259
'<div><ng-include src="url">content</ng-include></div>',
266260
);
@@ -272,7 +266,6 @@ describe("ngInclude", () => {
272266
});
273267

274268
it("should be async even if served from cache", (done) => {
275-
window.angular.module("myModule", []);
276269
element = createElementFromHTML(
277270
'<div><ng-include src="url"></ng-include></div>',
278271
);
@@ -287,7 +280,6 @@ describe("ngInclude", () => {
287280
});
288281

289282
it("should discard pending xhr callbacks if a new template is requested before the current finished loading", (done) => {
290-
window.angular.module("myModule", []);
291283
element = createElementFromHTML(
292284
"<div><ng-include src='templateUrl'></ng-include></div>",
293285
);

src/services/exception/exception-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class ExceptionHandlerProvider {
5757

5858
/** @type {ErrorHandler} */
5959
this.errorHandler = (exception, cause) => {
60-
this.log.error(exception, cause);
60+
throw exception;
6161
};
6262

6363
this.$get = [

0 commit comments

Comments
 (0)