{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/2483","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/2483/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/2483/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/2483/events","html_url":"https://github.com/realm/realm-cocoa/issues/2483","id":104801375,"number":2483,"title":"Cannot instantiate Realm() gives call can throw error Swift 2","user":{"login":"bryan1anderson","id":7976521,"avatar_url":"https://avatars.githubusercontent.com/u/7976521?v=3","gravatar_id":"","url":"https://api.github.com/users/bryan1anderson","html_url":"https://github.com/bryan1anderson","followers_url":"https://api.github.com/users/bryan1anderson/followers","following_url":"https://api.github.com/users/bryan1anderson/following{/other_user}","gists_url":"https://api.github.com/users/bryan1anderson/gists{/gist_id}","starred_url":"https://api.github.com/users/bryan1anderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryan1anderson/subscriptions","organizations_url":"https://api.github.com/users/bryan1anderson/orgs","repos_url":"https://api.github.com/users/bryan1anderson/repos","events_url":"https://api.github.com/users/bryan1anderson/events{/privacy}","received_events_url":"https://api.github.com/users/bryan1anderson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-03T23:32:05Z","updated_at":"2015-09-04T05:19:28Z","closed_at":null,"body":"      let realm = try! Realm()\r\n                        \r\n                         realm.write {\r\n                            realm.create(Notifications, value: objectDictionary, update: true)\r\n                            \r\n                            var nots = realm.objects(Notifications)\r\n                            print(nots)\r\n                        }\r\n\r\nthats how I am currently trying to create objects. With Swift 2.0 the error was introduced \"call can throw, but is not marked with try and the error is not handled.\"\r\n\r\ntry! is supposed to silence this error, which is does, however my method exits the scope the second it hits the `let realm = try! Realm()` line of code.\r\n\r\nSo I have tried handling it this way:\r\n\r\n          do {\r\n                            let realm = try Realm()\r\n                            \r\n                            do {\r\n                                \r\n                                try realm.write {\r\n                                    realm.create(Notifications, value: objectDictionary, update: true)\r\n                                    \r\n                                    var nots = realm.objects(Notifications)\r\n                                    print(nots)\r\n                                }\r\n                            } catch {\r\n                                print(\"nope\")\r\n                            }\r\n                            \r\n                        } catch {\r\n                            print(\"nope didn't work\")\r\n                        }\r\n                        \r\n                        \r\n                        \r\nSilences all errors, and... exits scope when it hits `let realm = try Realm()`\r\n\r\nOnly it doesn't go to the catch which I thought was supposed to happen. Just exits the method. "},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/137650805","html_url":"https://github.com/realm/realm-cocoa/issues/2483#issuecomment-137650805","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/2483","id":137650805,"user":{"login":"bryan1anderson","id":7976521,"avatar_url":"https://avatars.githubusercontent.com/u/7976521?v=3","gravatar_id":"","url":"https://api.github.com/users/bryan1anderson","html_url":"https://github.com/bryan1anderson","followers_url":"https://api.github.com/users/bryan1anderson/followers","following_url":"https://api.github.com/users/bryan1anderson/following{/other_user}","gists_url":"https://api.github.com/users/bryan1anderson/gists{/gist_id}","starred_url":"https://api.github.com/users/bryan1anderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryan1anderson/subscriptions","organizations_url":"https://api.github.com/users/bryan1anderson/orgs","repos_url":"https://api.github.com/users/bryan1anderson/repos","events_url":"https://api.github.com/users/bryan1anderson/events{/privacy}","received_events_url":"https://api.github.com/users/bryan1anderson/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T05:19:28Z","updated_at":"2015-09-04T05:19:28Z","body":"So just be be clear, nothing I have done stops the fact that attempting to instantiate Realm will exit the scope"}}