{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/14648","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/14648/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14648/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/14648/events","html_url":"https://github.com/angular/angular.js/issues/14648","id":156176995,"number":14648,"title":"Returning a promise as the result of a $http then causes a weird behavior when said promise is cancelled","user":{"login":"odedniv","id":894198,"avatar_url":"https://avatars.githubusercontent.com/u/894198?v=3","gravatar_id":"","url":"https://api.github.com/users/odedniv","html_url":"https://github.com/odedniv","followers_url":"https://api.github.com/users/odedniv/followers","following_url":"https://api.github.com/users/odedniv/following{/other_user}","gists_url":"https://api.github.com/users/odedniv/gists{/gist_id}","starred_url":"https://api.github.com/users/odedniv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odedniv/subscriptions","organizations_url":"https://api.github.com/users/odedniv/orgs","repos_url":"https://api.github.com/users/odedniv/repos","events_url":"https://api.github.com/users/odedniv/events{/privacy}","received_events_url":"https://api.github.com/users/odedniv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-22T22:27:31Z","updated_at":"2016-05-22T22:27:31Z","closed_at":null,"body":"**Steps to reproduce and a minimal demo of the problem**\r\n\r\n* Simple case with just `$q`: https://jsfiddle.net/fvdgsjoL/2/\r\n\r\n1. Create a promise (A).\r\n2. Return a second promise (B) as a result of a function given to the `then` of promise A.\r\n3. Resolve promise A (either before or after 4, doesn't happen otherwise).\r\n4. Cancel promise B.\r\n\r\n* Real scenario with `$http` and `$timeout`: https://jsfiddle.net/4ao7cw31/3/\r\n\r\n1. Create $http request.\r\n2. Return a $timeout as a result of a function given to the `then` of a $http request (done by mistake, CoffeeScript).\r\n3. Cancel the timeout at some point.\r\n\r\n**Current behavior**\r\n\r\nPromise A (the $http request) is rejected with whatever was given to the `reject()` of promise B (\"canceled\" in case of canceling a `$timeout`), even though it was already resolved.\r\n\r\n**Expected/desired behavior**\r\n\r\nThis is very confusing and was hard to track down. Could not figure out where the `catch`'s response was coming from or how it is possible for both the `then` and `catch` to be called.\r\n\r\nNot sure this is documented or expected.\r\n\r\n**Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.**\r\n\r\nAngular 1.4.8, Chromium, Linux.\r\n"}}
{"actor":{"display_login":"odedniv"}}