{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/3577","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3577/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3577/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3577/events","html_url":"https://github.com/realm/realm-cocoa/issues/3577","id":154744089,"number":3577,"title":"[minor issue] Realm Core throws due schema mismatch, even if deleteRealmIfMigrationNeeded is set to true","user":{"login":"icanzilb","id":633862,"avatar_url":"https://avatars.githubusercontent.com/u/633862?v=3","gravatar_id":"","url":"https://api.github.com/users/icanzilb","html_url":"https://github.com/icanzilb","followers_url":"https://api.github.com/users/icanzilb/followers","following_url":"https://api.github.com/users/icanzilb/following{/other_user}","gists_url":"https://api.github.com/users/icanzilb/gists{/gist_id}","starred_url":"https://api.github.com/users/icanzilb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icanzilb/subscriptions","organizations_url":"https://api.github.com/users/icanzilb/orgs","repos_url":"https://api.github.com/users/icanzilb/repos","events_url":"https://api.github.com/users/icanzilb/events{/privacy}","received_events_url":"https://api.github.com/users/icanzilb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/S:Waiting%20For%20User","name":"S:Waiting For User","color":"ededed"},{"url":"https://api.github.com/repos/realm/realm-cocoa/labels/T:Help","name":"T:Help","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-13T15:51:55Z","updated_at":"2016-05-15T09:49:04Z","closed_at":null,"body":"## Goals\r\n\r\nRelease 0.102.0 includes the following enhancement \"Add deleteRealmIfMigrationNeeded to RLMRealmConfiguration/Realm.Configuration. When this is set to true, the Realm file will be automatically deleted and recreated when there is a schema mismatch rather than migrated to the new schema.\"\r\n\r\nDiscussion: This is a relatively minor problem because the exception is swallowed at RLMRealm.mm:406 but I'm just wondering if this feature is supposed to be available across threads shouldn't  `deleteRealmIfMigrationNeeded` be handled at core level instead of throwing and handling this in the C++ library? E.g. if this is an intended behavior should the core use exceptions to talk to the bindings to implement logic?\r\n\r\n## Expected Results\r\n\r\nI expect when I have a schema mismatch calling \"Realm()\" to simply delete the old file and keep on.\r\n\r\n## Actual Results\r\n\r\n`Realm()` throws an exception about schema mismatch\r\n\r\n## Steps to Reproduce\r\n\r\ncode below\r\n\r\n## Code Sample\r\n\r\nHere's the code to reproduce (provided you have a schema mismatch):\r\n\r\n```swift\r\nvar config = Realm.Configuration()\r\nconfig.deleteRealmIfMigrationNeeded = true\r\nRealm.Configuration.defaultConfiguration = config\r\nlet realm = try! Realm()\r\n```\r\n\r\n## Version of Realm and Tooling\r\n\r\nRealm version: via CocoaPods\r\n\r\nUsing Realm (0.102.0)\r\nUsing RealmSwift (0.102.0)\r\n\r\nXcode version: Version 7.3.1 (7D1014)\r\n\r\niOS/OSX version: Version 9.3 (SimulatorApp-645.9 \r\n\r\nDependency manager + version: CocoaPods 1.0.0 (release)\r\n"},"comment":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/comments/219275923","html_url":"https://github.com/realm/realm-cocoa/issues/3577#issuecomment-219275923","issue_url":"https://api.github.com/repos/realm/realm-cocoa/issues/3577","id":219275923,"user":{"login":"icanzilb","id":633862,"avatar_url":"https://avatars.githubusercontent.com/u/633862?v=3","gravatar_id":"","url":"https://api.github.com/users/icanzilb","html_url":"https://github.com/icanzilb","followers_url":"https://api.github.com/users/icanzilb/followers","following_url":"https://api.github.com/users/icanzilb/following{/other_user}","gists_url":"https://api.github.com/users/icanzilb/gists{/gist_id}","starred_url":"https://api.github.com/users/icanzilb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icanzilb/subscriptions","organizations_url":"https://api.github.com/users/icanzilb/orgs","repos_url":"https://api.github.com/users/icanzilb/repos","events_url":"https://api.github.com/users/icanzilb/events{/privacy}","received_events_url":"https://api.github.com/users/icanzilb/received_events","type":"User","site_admin":false},"created_at":"2016-05-15T09:49:04Z","updated_at":"2016-05-15T09:49:04Z","body":"Yes, I'm just wondering why an exception is used for something that works just fine. I've been told a number of times using error handling mechanisms to implement logic was wrong (and I feel that way myself too)"}}