diff --git a/src/ng/q.js b/src/ng/q.js index 3bfc61386..2bc9d03aa 100644 --- a/src/ng/q.js +++ b/src/ng/q.js @@ -683,5 +683,11 @@ function markQStateExceptionHandled(state) { state.pur = true; } function markQExceptionHandled(q) { - markQStateExceptionHandled(q.$$state); + // Built-in `$q` promises will always have a `$$state` property. This check is to allow + // overwriting `$q` with a different promise library (e.g. Bluebird + angular-bluebird-promises). + // (Currently, this is the only method that might be called with a promise, even if it is not + // created by the built-in `$q`.) + if (q.$$state) { + markQStateExceptionHandled(q.$$state); + } }