@@ -33,19 +33,21 @@ export class StateService {
33
33
get current ( ) { return this . router . globals . current ; }
34
34
get $current ( ) { return this . router . globals . $current ; }
35
35
36
+ /** @hidden */
36
37
constructor ( private router : UIRouter ) {
37
38
let getters = [ 'current' , '$current' , 'params' , 'transition' ] ;
38
39
let boundFns = Object . keys ( StateService . prototype ) . filter ( key => getters . indexOf ( key ) === - 1 ) ;
39
40
bindFunctions ( StateService . prototype , this , this , boundFns ) ;
40
41
}
41
42
42
43
/**
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.
46
49
*
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.
49
51
*/
50
52
private _handleInvalidTargetState ( fromPath : PathNode [ ] , $to$ : TargetState ) {
51
53
let globals = < Globals > this . router . globals ;
@@ -482,6 +484,10 @@ export class StateService {
482
484
private _defaultErrorHandler : ( ( _error ) => void ) = function $defaultErrorHandler ( $error$ ) {
483
485
if ( $error$ instanceof Error && $error$ . stack ) {
484
486
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 ) ;
485
491
} else {
486
492
console . error ( $error$ ) ;
487
493
}
0 commit comments