Handle and recover from failures like running out of disk space

47 views
Skip to first unread message

Zsombor Papp

unread,
Dec 23, 2015, 8:35:32 PM12/23/15
to Realm
Hi,

could you please clarify the following (quoted from the Realm Swift intro, https://realm.io/docs/swift/latest/#getting-started):

Because write transactions could potentially fail like any other disk IO operations, both Realm.write() & Realm.commitWrite() are marked as throws so you can handle and recover from failures like running out of disk space. There are no other recoverable errors.

Does this mean that Realm.write() and Realm.commitWrite() will only throw if the device ran out of disk space?

If that's not the case, then how can I tell (programmatically...) the reason for the exception?

Thanks,
Zsombor

Thomas Goyne

unread,
Dec 23, 2015, 8:58:52 PM12/23/15
to Zsombor Papp, realm...@googlegroups.com
Running out of disk space or running out of memory are the only "expected" error conditions for committing a write transaction. The only other exceptions thrown are to report system calls unexpectedly failing due to things like Realm's temporary files being deleted while it's trying to use them. Unfortunately none of the exceptions thrown when committing a write transaction currently have error codes, but we did recently agree that out-of-memory and out-of-disk really should, so that will probably be added soon after the relevant people return from vacation.

--
Thomas Goyne

{#HS:153376535-2539#}
--
You received this message because you are subscribed to the Google Groups "Realm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to realm-cocoa...@googlegroups.com.
To post to this group, send email to realm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/realm-cocoa/e873fc5f-99e5-4dba-bdbe-dd69a509b1bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages