Error

public enum Error: ErrorType

Enumeration that describes the error codes within the Realm error domain. The values can be used to catch a variety of recoverable errors, especially those happening when initializing a Realm instance.

let realm: Realm?
do {
    realm = Realm()
} catch RealmSwift.Error.IncompatibleLockFile() {
    print("Realm Browser app may be attached to Realm on device?")
}
  • Error thrown by Realm if no other specific error is returned when a realm is opened.

    Declaration

    Swift

    case Fail
  • Error thrown by Realm for any I/O related exception scenarios when a realm is opened.

    Declaration

    Swift

    case FileAccess
  • Error thrown by Realm if the user does not have permission to open or create the specified file in the specified access mode when the realm is opened.

    Declaration

    Swift

    case FilePermissionDenied
  • Error thrown by Realm if the file already exists when a copy should be written.

    Declaration

    Swift

    case FileExists
  • Error thrown by Realm if no file was found when a realm was opened as read-only or if the directory part of the specified path was not found when a copy should be written.

    Declaration

    Swift

    case FileNotFound
  • Error thrown by Realm if the database file is currently open in another process which cannot share with the current process due to an architecture mismatch.

    Declaration

    Swift

    case IncompatibleLockFile
  • Error thrown by Realm if a file format upgrade is required to open the file, but upgrades were explicitly disabled.

    Declaration

    Swift

    case FileFormatUpgradeRequired
  • Error thrown by Realm if there is a schema version mismatch, so that a migration is required.

    Declaration

    Swift

    case SchemaMismatch