Error

public enum Error: ErrorType

Error is an enum representing all recoverable errors. It is associated with the Realm error domain specified in RLMErrorDomain.

Error is a Swift ErrorType:

let realm: Realm?
do {
    realm = try Realm()
} catch RealmSwift.Error.IncompatibleLockFile() {
    print("Incompatible lock file. The Realm Browser app might be attached to a Realm on the device.")
}
  • Denotes a general error that occurred when trying to open a Realm.

    Declaration

    Swift

    case Fail
  • Denotes a file I/O error that occurred when trying to open a Realm.

    Declaration

    Swift

    case FileAccess
  • Denotes a file permission error that ocurred when trying to open a Realm.

    This error can occur if the user does not have permission to open or create the specified file in the specified access mode when opening a Realm.

    Declaration

    Swift

    case FilePermissionDenied
  • Denotes an error where a file was to be written to disk, but another file with the same name already exists.

    Declaration

    Swift

    case FileExists
  • Denotes an error that occurs if a file could not be found.

    This error may occur if a Realm file could not be found on disk when trying to open a Realm as read-only, or if the directory part of the specified path was not found when trying to write a copy.

    Declaration

    Swift

    case FileNotFound
  • Denotes an error that occurs if the database file is currently open in another process which cannot share with the current process due to an architecture mismatch.

    This error may occur if trying to share a Realm file between an i386 (32-bit) iOS Simulator and the Realm Browser application. In this case, please use the 64-bit version of the iOS Simulator.

    Declaration

    Swift

    case IncompatibleLockFile
  • Denotes an error that occurs if a file format upgrade is required to open the file, but upgrades were explicitly disabled.

    Declaration

    Swift

    case FileFormatUpgradeRequired
  • Denotes an error that occurs if there is a schema version mismatch, so that a migration is required.

    Declaration

    Swift

    case SchemaMismatch