{"action":"created","issue":{"url":"https://api.github.com/repos/mxcl/PromiseKit/issues/13","labels_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/13/comments","events_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/13/events","html_url":"https://github.com/mxcl/PromiseKit/issues/13","id":32744343,"number":13,"title":"\"Fix\" error handling","user":{"login":"mbinna","id":161041,"avatar_url":"https://avatars.githubusercontent.com/u/161041?v=3","gravatar_id":"","url":"https://api.github.com/users/mbinna","html_url":"https://github.com/mbinna","followers_url":"https://api.github.com/users/mbinna/followers","following_url":"https://api.github.com/users/mbinna/following{/other_user}","gists_url":"https://api.github.com/users/mbinna/gists{/gist_id}","starred_url":"https://api.github.com/users/mbinna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbinna/subscriptions","organizations_url":"https://api.github.com/users/mbinna/orgs","repos_url":"https://api.github.com/users/mbinna/repos","events_url":"https://api.github.com/users/mbinna/events{/privacy}","received_events_url":"https://api.github.com/users/mbinna/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2014-05-03T10:27:33Z","updated_at":"2015-03-04T23:51:28Z","closed_at":"2014-05-04T18:28:33Z","body":"Why does PromiseKit propagate exceptions (instances of the class `NSException`) to clients? Wouldn't it be more appropriate to follow the Cocoa convention of using errors (instances of the class `NSError`) exclusively to indicate failure?\r\n\r\nSince clients rescue from erros instead of catch exceptions, I suggest to rename `-[Promise catch]` to `-[Promise rescue]` or `-[Promise error]`. If clients write code that throws exceptions, it is the clients fault that should be handled during development. Error handling at runtime should not occur by catching exceptions.\r\n\r\nThe [Error Handling Programming Guide - A Note on Errors and Exceptions](https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/CreateCustomizeNSError.html#//apple_ref/doc/uid/TP40001806-CH204-SW6) states the following:\r\n\r\n> It is important to keep in mind the difference between error objects and exception objects in Cocoa and Cocoa Touch, and when to use one or the other in your code. They serve different purposes and should not be confused.\r\n\r\n> Exceptions (represented by NSException objects) are for programming errors, such as an array index that is out of bounds or an invalid method argument. User-level errors (represented by NSError objects) are for runtime errors, such as when a file cannot be found or a string in a certain encoding cannot be read. Conditions giving rise to exceptions are due to programming errors; you should deal with these errors before you ship a product. Runtime errors can always occur, and you should communicate these (via NSError objects) to the user in as much detail as is required.\r\n\r\n> Although exceptions should ideally be taken care of before deployment, a shipped application can still experience exceptions as a result of some truly exceptional situation such as “out of memory” or “boot volume not available.” It is best to allow the highest level of the application—the global application object itself—to deal with these situations.\"\r\n\r\nLet me know what you think."},"comment":{"url":"https://api.github.com/repos/mxcl/PromiseKit/issues/comments/77276957","html_url":"https://github.com/mxcl/PromiseKit/issues/13#issuecomment-77276957","issue_url":"https://api.github.com/repos/mxcl/PromiseKit/issues/13","id":77276957,"user":{"login":"marklarr","id":760261,"avatar_url":"https://avatars.githubusercontent.com/u/760261?v=3","gravatar_id":"","url":"https://api.github.com/users/marklarr","html_url":"https://github.com/marklarr","followers_url":"https://api.github.com/users/marklarr/followers","following_url":"https://api.github.com/users/marklarr/following{/other_user}","gists_url":"https://api.github.com/users/marklarr/gists{/gist_id}","starred_url":"https://api.github.com/users/marklarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marklarr/subscriptions","organizations_url":"https://api.github.com/users/marklarr/orgs","repos_url":"https://api.github.com/users/marklarr/repos","events_url":"https://api.github.com/users/marklarr/events{/privacy}","received_events_url":"https://api.github.com/users/marklarr/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T23:51:28Z","updated_at":"2015-03-04T23:51:28Z","body":"The preprocessor redefine is definitely good. Though, I no longer work on the Venmo iOS app, I now work on Ruby at Braintree for transaction processing. I was investigating this for a personal project :)"}}