docs/content/error/$timeout/badprom.ngdoc
@ngdoc error
@name $timeout:badprom
@fullName Non-$timeout promise
@description
This error occurs when calling {@link ng.$timeout#cancel $timeout.cancel()} with a promise that
was not generated by the {@link ng.$timeout $timeout} service. This can, for example, happen when
calling {@link ng.$q#the-promise-api then()/catch()} on the returned promise, which creates a new
promise, and pass that new promise to {@link ng.$timeout#cancel $timeout.cancel()}.
Example of incorrect usage that leads to this error:
```js
var promise = $timeout(doSomething, 1000).then(doSomethingElse);
$timeout.cancel(promise);
```
To fix the example above, keep a reference to the promise returned by
{@link ng.$timeout $timeout()} and pass that to {@link ng.$timeout#cancel $timeout.cancel()}:
```js
var promise = $timeout(doSomething, 1000);
var newPromise = promise.then(doSomethingElse);
$timeout.cancel(promise);
```