This repository was archived by the owner on Feb 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,6 +172,12 @@ describe('Zone.patch', function () {
172172 expect ( leaveSpy ) . toHaveBeenCalled ( ) ;
173173 } ) ;
174174
175+ it ( 'should throw if onError is not defined' , function ( ) {
176+ expect ( function ( ) {
177+ zone . run ( throwError ) ;
178+ } ) . toThrow ( ) ;
179+ } ) ;
180+
175181 it ( 'should fire onError if a function run by a zone throws' , function ( ) {
176182 var errorSpy = jasmine . createSpy ( ) ;
177183 var myZone = zone . fork ( {
@@ -180,9 +186,9 @@ describe('Zone.patch', function () {
180186
181187 expect ( errorSpy ) . not . toHaveBeenCalled ( ) ;
182188
183- myZone . run ( function ( ) {
184- throw new Error ( 'test' ) ;
185- } ) ;
189+ expect ( function ( ) {
190+ myZone . run ( throwError ) ;
191+ } ) . not . toThrow ( ) ;
186192
187193 expect ( errorSpy ) . toHaveBeenCalled ( ) ;
188194 } ) ;
@@ -222,3 +228,7 @@ describe('Zone.patch', function () {
222228 } ) ;
223229
224230} ) ;
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 = {
4242 } catch ( e ) {
4343 if ( zone . onError ) {
4444 zone . onError ( e ) ;
45+ } else {
46+ throw e ;
4547 }
4648 } finally {
4749 this . onZoneLeave ( ) ;
You can’t perform that action at this time.
0 commit comments