This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree 2 files changed +15
-3
lines changed
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,12 @@ describe('Zone.patch', function () {
172
172
expect ( leaveSpy ) . toHaveBeenCalled ( ) ;
173
173
} ) ;
174
174
175
+ it ( 'should throw if onError is not defined' , function ( ) {
176
+ expect ( function ( ) {
177
+ zone . run ( throwError ) ;
178
+ } ) . toThrow ( ) ;
179
+ } ) ;
180
+
175
181
it ( 'should fire onError if a function run by a zone throws' , function ( ) {
176
182
var errorSpy = jasmine . createSpy ( ) ;
177
183
var myZone = zone . fork ( {
@@ -180,9 +186,9 @@ describe('Zone.patch', function () {
180
186
181
187
expect ( errorSpy ) . not . toHaveBeenCalled ( ) ;
182
188
183
- myZone . run ( function ( ) {
184
- throw new Error ( 'test' ) ;
185
- } ) ;
189
+ expect ( function ( ) {
190
+ myZone . run ( throwError ) ;
191
+ } ) . not . toThrow ( ) ;
186
192
187
193
expect ( errorSpy ) . toHaveBeenCalled ( ) ;
188
194
} ) ;
@@ -222,3 +228,7 @@ describe('Zone.patch', function () {
222
228
} ) ;
223
229
224
230
} ) ;
231
+
232
+ function throwError ( ) {
233
+ throw new Error ( ) ;
234
+ }
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ Zone.prototype = {
42
42
} catch ( e ) {
43
43
if ( zone . onError ) {
44
44
zone . onError ( e ) ;
45
+ } else {
46
+ throw e ;
45
47
}
46
48
} finally {
47
49
this . onZoneLeave ( ) ;
You can’t perform that action at this time.
0 commit comments