{"action":"closed","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/2600","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/2600/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/2600/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/2600/events","html_url":"https://github.com/realm/realm-cocoa/issues/2600","id":108943420,"number":2600,"title":"Swift 2.0 try and Results<T>","user":{"login":"MattKiazyk","id":1119565,"avatar_url":"https://avatars.githubusercontent.com/u/1119565?v=3","gravatar_id":"","url":"https://api.github.com/users/MattKiazyk","html_url":"https://github.com/MattKiazyk","followers_url":"https://api.github.com/users/MattKiazyk/followers","following_url":"https://api.github.com/users/MattKiazyk/following{/other_user}","gists_url":"https://api.github.com/users/MattKiazyk/gists{/gist_id}","starred_url":"https://api.github.com/users/MattKiazyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MattKiazyk/subscriptions","organizations_url":"https://api.github.com/users/MattKiazyk/orgs","repos_url":"https://api.github.com/users/MattKiazyk/repos","events_url":"https://api.github.com/users/MattKiazyk/events{/privacy}","received_events_url":"https://api.github.com/users/MattKiazyk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/Help","name":"Help","color":"cc317c"},{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/pending","name":"pending","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"jpsim","id":474794,"avatar_url":"https://avatars.githubusercontent.com/u/474794?v=3","gravatar_id":"","url":"https://api.github.com/users/jpsim","html_url":"https://github.com/jpsim","followers_url":"https://api.github.com/users/jpsim/followers","following_url":"https://api.github.com/users/jpsim/following{/other_user}","gists_url":"https://api.github.com/users/jpsim/gists{/gist_id}","starred_url":"https://api.github.com/users/jpsim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpsim/subscriptions","organizations_url":"https://api.github.com/users/jpsim/orgs","repos_url":"https://api.github.com/users/jpsim/repos","events_url":"https://api.github.com/users/jpsim/events{/privacy}","received_events_url":"https://api.github.com/users/jpsim/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-09-29T19:36:05Z","updated_at":"2015-09-29T20:14:57Z","closed_at":"2015-09-29T20:14:57Z","body":"Hi,\r\n\r\nThis is more of a discussion for how a person would handle a situation now in Swift 2.0 where we have to catch when calling `let realm = Realm()`\r\n\r\nSay I have the following code:\r\n```\r\nclass Reward: Object {\r\n  dynamic var title = \"\"\r\n  dynamic var isExpired = false\r\n\r\n class func validRewards() -> Results<Reward>? {\r\n        do {\r\n           return try Realm().objects(Reward).filter(NSPredicate(format: \"isExpired = false\"))\r\n        } catch {\r\n            return nil\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nI have a `validRewards()` function that returns `Result<Reward>`. If the original try fails - I would return nil since I'm only want to know if there are any Rewards.\r\n\r\nI'm not a fan of the optional `Results<Reward>?` simply because i know if results.count = 0 there are none. So in my view, i now would have to unwrap the results optional everywhere. \r\n\r\nIn what way would `Realm()` fail? In 0.95, you had the `commitWrite()` throw but in 0.95.2 it now doesn't. I think in more cases we would want `commitWrite()` to throw as if that change failed, we could rollback and do other cleanup, etc. Why was that reverted?\r\n\r\nAgain this is more of a discussion about how best to catch these errors in general. \r\n\r\nThanks\r\n\r\n-Matt"}}