File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ describe("PubSub", function () {
1717 let pubsub ;
1818
1919 beforeEach ( function ( ) {
20- pubsub = new PubSub ( ) ;
20+ pubsub = new PubSub ( ( ) => undefined ) ;
2121 } ) ;
2222
2323 afterEach ( function ( ) {
@@ -31,7 +31,7 @@ describe("PubSub", function () {
3131 } ) ;
3232
3333 it ( "should provide injecables" , function ( ) {
34- expect ( pubsub . $exceptionHandler ) . not . toBeNull ( ) ;
34+ expect ( pubsub . _exceptionHandler ) . not . toBeNull ( ) ;
3535 } ) ;
3636
3737 it ( "should dispose of the PubSub instance" , function ( ) {
@@ -429,23 +429,23 @@ describe("PubSub", function () {
429429
430430 it ( "should delegate to exception handler if an error is thrown" , async function ( ) {
431431 let thrown = false ;
432- let throwErro = new Error ( ) ;
432+ let thrownError = new Error ( ) ;
433433 let receivedErr ;
434434
435- pubsub . $exceptionHandler = ( err ) => {
435+ pubsub = new PubSub ( ( err ) => {
436436 thrown = true ;
437437 receivedErr = err ;
438- } ;
438+ } ) ;
439439
440440 pubsub . subscribe ( SOME_TOPIC , ( ) => {
441- throw throwErro ;
441+ throw thrownError ;
442442 } ) ;
443443
444444 pubsub . publish ( SOME_TOPIC ) ;
445445 await wait ( ) ;
446446
447447 expect ( thrown ) . toBe ( true ) ;
448- expect ( receivedErr ) . toBe ( throwErro ) ;
448+ expect ( receivedErr ) . toBe ( thrownError ) ;
449449 } ) ;
450450 } ) ;
451451} ) ;
Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ export class PubSub {
3636 private _topics : Record < string , ListenerEntry [ ] > ;
3737 /** @internal */
3838 private _disposed : boolean ;
39- /** Exception handler used when a subscriber throws during async delivery. */
40- public $exceptionHandler : ng . ExceptionHandlerService ;
39+ /** @internal */
40+ private _exceptionHandler : ng . ExceptionHandlerService ;
4141
4242 /**
4343 * Create a publish/subscribe event bus.
@@ -50,7 +50,7 @@ export class PubSub {
5050 constructor ( $exceptionHandler : ng . ExceptionHandlerService ) {
5151 this . _topics = nullObject ( ) as Record < string , ListenerEntry [ ] > ;
5252 this . _disposed = false ;
53- this . $exceptionHandler = $exceptionHandler ;
53+ this . _exceptionHandler = $exceptionHandler ;
5454 }
5555
5656 /**
@@ -204,7 +204,7 @@ export class PubSub {
204204 try {
205205 fn . apply ( context , args ) ;
206206 } catch ( err ) {
207- this . $exceptionHandler ( err ) ;
207+ this . _exceptionHandler ( err ) ;
208208 }
209209 }
210210 } ) ;
You can’t perform that action at this time.
0 commit comments