{"action":"created","issue":{"url":"https://api.github.com/repos/mxcl/PromiseKit/issues/98","repository_url":"https://api.github.com/repos/mxcl/PromiseKit","labels_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/98/comments","events_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/98/events","html_url":"https://github.com/mxcl/PromiseKit/issues/98","id":44607249,"number":98,"title":"Swift: reject a 'then' with an NSError","user":{"login":"dtrukr","id":658322,"avatar_url":"https://avatars0.githubusercontent.com/u/658322?v=4","gravatar_id":"","url":"https://api.github.com/users/dtrukr","html_url":"https://github.com/dtrukr","followers_url":"https://api.github.com/users/dtrukr/followers","following_url":"https://api.github.com/users/dtrukr/following{/other_user}","gists_url":"https://api.github.com/users/dtrukr/gists{/gist_id}","starred_url":"https://api.github.com/users/dtrukr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtrukr/subscriptions","organizations_url":"https://api.github.com/users/dtrukr/orgs","repos_url":"https://api.github.com/users/dtrukr/repos","events_url":"https://api.github.com/users/dtrukr/events{/privacy}","received_events_url":"https://api.github.com/users/dtrukr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2014-10-01T19:43:23Z","updated_at":"2018-02-22T19:08:35Z","closed_at":"2014-10-01T20:57:22Z","author_association":"NONE","body":"I've been really enjoying using PromiseKit for Objective-C, thanks for all your work.\nI'm trying to rewrite some of my logic with PromiseKit for Swift and cannot seem to figure out how to reject a 'then' with an NSError. Is this possible in the Swift version?\n\n```\n    let p = Promise{(fulfiller, rejecter) in\n            fulfiller(true)\n        }\n\n        p.then{_ -> Bool in\n            println(\"then 1\")\n//          the following line does not compile\n//          return NSError(domain: \"error\", code: 100, userInfo: nil)\n            return true\n        }.then{_ -> Bool in\n            println(\"then 2\")\n            return true\n        }.catch{(error:NSError) -> Void in\n            println(error.localizedDescription)\n        }\n```\n\nIf I replace the first 'then' with the following it compiles fine but does not reject the promise (e.g. it goes into the second 'then' instead of going to the 'catch'):\n\n```\n...\n      p.then{_ -> AnyObject in\n            println(\"then 1\")\n           return NSError(domain: \"error\", code: 100, userInfo: nil)\n        }\n...\n```\n"},"comment":{"url":"https://api.github.com/repos/mxcl/PromiseKit/issues/comments/367787136","html_url":"https://github.com/mxcl/PromiseKit/issues/98#issuecomment-367787136","issue_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/98","id":367787136,"user":{"login":"michael-mckenna","id":14035148,"avatar_url":"https://avatars3.githubusercontent.com/u/14035148?v=4","gravatar_id":"","url":"https://api.github.com/users/michael-mckenna","html_url":"https://github.com/michael-mckenna","followers_url":"https://api.github.com/users/michael-mckenna/followers","following_url":"https://api.github.com/users/michael-mckenna/following{/other_user}","gists_url":"https://api.github.com/users/michael-mckenna/gists{/gist_id}","starred_url":"https://api.github.com/users/michael-mckenna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael-mckenna/subscriptions","organizations_url":"https://api.github.com/users/michael-mckenna/orgs","repos_url":"https://api.github.com/users/michael-mckenna/repos","events_url":"https://api.github.com/users/michael-mckenna/events{/privacy}","received_events_url":"https://api.github.com/users/michael-mckenna/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T19:08:35Z","updated_at":"2018-02-22T19:08:35Z","author_association":"NONE","body":"Thanks for the quick response.\r\n\r\nI was getting an error which brought me here. I'm following [the failing chains section](https://github.com/mxcl/PromiseKit/blob/master/Documentation/CommonPatterns.md#failing-chains) and I'm getting an error. "}}
{"actor":{"display_login":"michael-mckenna"}}