@@ -33,19 +33,21 @@ export class StateService {
3333 get current ( ) { return this . router . globals . current ; }
3434 get $current ( ) { return this . router . globals . $current ; }
3535
36+ /** @hidden */
3637 constructor ( private router : UIRouter ) {
3738 let getters = [ 'current' , '$current' , 'params' , 'transition' ] ;
3839 let boundFns = Object . keys ( StateService . prototype ) . filter ( key => getters . indexOf ( key ) === - 1 ) ;
3940 bindFunctions ( StateService . prototype , this , this , boundFns ) ;
4041 }
4142
4243 /**
43- * Invokes the onInvalid callbacks, in natural order. Each callback's return value is checked in sequence
44- * until one of them returns an instance of TargetState. The results of the callbacks are wrapped
45- * in $q.when(), so the callbacks may return promises.
44+ * Handler for when [[transitionTo]] is called with an invalid state.
45+ *
46+ * Invokes the [[onInvalid]] callbacks, in natural order.
47+ * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.
48+ * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.
4649 *
47- * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and
48- * the result returned.
50+ * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.
4951 */
5052 private _handleInvalidTargetState ( fromPath : PathNode [ ] , $to$ : TargetState ) {
5153 let globals = < Globals > this . router . globals ;
@@ -482,6 +484,10 @@ export class StateService {
482484 private _defaultErrorHandler : ( ( _error ) => void ) = function $defaultErrorHandler ( $error$ ) {
483485 if ( $error$ instanceof Error && $error$ . stack ) {
484486 console . error ( $error$ . stack ) ;
487+ } else if ( $error$ instanceof Rejection ) {
488+ console . error ( $error$ ) ;
489+ if ( $error$ . detail && $error$ . detail . stack )
490+ console . error ( $error$ . detail . stack ) ;
485491 } else {
486492 console . error ( $error$ ) ;
487493 }
0 commit comments