Error
public struct Error
Struct 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 = try Realm()
} catch Realm.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
public static let fail: Code = .fail
-
Error thrown by Realm for any I/O related exception scenarios when a realm is opened.
Declaration
Swift
public static let fileAccess: Code = .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
public static let filePermissionDenied: Code = .filePermissionDenied
-
Error thrown by Realm if the file already exists when a copy should be written.
Declaration
Swift
public static let fileExists: Code = .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
public static let fileNotFound: Code = .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
public static let incompatibleLockFile: Code = .incompatibleLockFile
-
Error thrown by Realm if a file format upgrade is required to open the file, but upgrades were explicitly disabled.
Declaration
Swift
public static let fileFormatUpgradeRequired: Code = .fileFormatUpgradeRequired
-
Error thrown by Realm if there is insufficient available address space.
Declaration
Swift
public static let addressSpaceExhausted: Code = .addressSpaceExhausted
-
Error thrown by Realm if there is a schema version mismatch, so that a migration is required.
Declaration
Swift
public static let schemaMismatch: Code = .schemaMismatch
-
Error thrown by Realm when attempting to open an incompatible synchronized Realm file.
This error occurs when the Realm file was created with an older version of Realm and an automatic migration to the current version is not possible. When such an error occurs, the original file is moved to a backup location, and future attempts to open the synchronized Realm will result in a new file being created. If you wish to migrate any data from the backup Realm, you can open it using the provided Realm configuration.
Declaration
Swift
public static let incompatibleSyncedFile: Code = .incompatibleSyncedFile
-
Realm configuration that can be used to open the backup copy of a Realm file
/ Only applicable to
incompatibleSyncedFile
. Will benil
for all other errors.Declaration
Swift
public var backupConfiguration: Realm.Configuration?