123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- import Realm
- extension Realm {
-
- public struct Error {
- public typealias Code = RLMError.Code
-
- public static let fail: Code = .fail
-
- public static let fileAccess: Code = .fileAccess
-
-
- public static let filePermissionDenied: Code = .filePermissionDenied
-
- public static let fileExists: Code = .fileExists
-
-
-
- public static let fileNotFound: Code = .fileNotFound
-
-
- public static let incompatibleLockFile: Code = .incompatibleLockFile
-
-
- public static let fileFormatUpgradeRequired: Code = .fileFormatUpgradeRequired
-
- public static let addressSpaceExhausted: Code = .addressSpaceExhausted
-
- public static let schemaMismatch: Code = .schemaMismatch
-
-
-
-
-
-
-
- public static let incompatibleSyncedFile: Code = .incompatibleSyncedFile
-
- public var code: Code {
- return (_nsError as! RLMError).code
- }
-
- public let _nsError: NSError
-
- public init(_nsError error: NSError) {
- _nsError = error
- }
-
-
-
- public var backupConfiguration: Realm.Configuration? {
- let configuration = userInfo[RLMBackupRealmConfigurationErrorKey] as! RLMRealmConfiguration?
- return configuration.map(Realm.Configuration.fromRLMRealmConfiguration)
- }
- }
- }
- extension Realm.Error: _BridgedStoredNSError {
-
- public static let _nsErrorDomain = RLMErrorDomain
-
- public static let errorDomain = RLMErrorDomain
- }
- extension Realm.Error: Equatable {}
- public func == (lhs: Error, rhs: Error) -> Bool {
- return lhs._code == rhs._code
- && lhs._domain == rhs._domain
- }
- public func ~= (lhs: Realm.Error, rhs: Error) -> Bool {
- return lhs == rhs
- }
|