Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
51
iphone/Maps/Core/iCloud/SynchronizationError.swift
Normal file
51
iphone/Maps/Core/iCloud/SynchronizationError.swift
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
@objc enum SynchronizationError: Int, Error {
|
||||
case fileUnavailable
|
||||
case fileNotUploadedDueToQuota
|
||||
case ubiquityServerNotAvailable
|
||||
case iCloudIsNotAvailable
|
||||
case containerNotFound
|
||||
case failedToOpenLocalDirectoryFileDescriptor
|
||||
case failedToRetrieveLocalDirectoryContent
|
||||
case failedToCreateMetadataItem
|
||||
case failedToRetrieveMetadataQueryContent
|
||||
}
|
||||
|
||||
extension SynchronizationError: LocalizedError {
|
||||
var errorDescription: String? {
|
||||
switch self {
|
||||
case .fileUnavailable, .ubiquityServerNotAvailable:
|
||||
return L("icloud_synchronization_error_connection_error")
|
||||
case .fileNotUploadedDueToQuota:
|
||||
return L("icloud_synchronization_error_quota_exceeded")
|
||||
case .iCloudIsNotAvailable, .containerNotFound:
|
||||
return L("icloud_synchronization_error_cloud_is_unavailable")
|
||||
case .failedToOpenLocalDirectoryFileDescriptor:
|
||||
return "Failed to open local directory file descriptor"
|
||||
case .failedToRetrieveLocalDirectoryContent:
|
||||
return "Failed to retrieve local directory content"
|
||||
case .failedToCreateMetadataItem:
|
||||
return "Failed to create metadata item."
|
||||
case .failedToRetrieveMetadataQueryContent:
|
||||
return "Failed to retrieve NSMetadataQuery content."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Error {
|
||||
var ubiquitousError: SynchronizationError? {
|
||||
let nsError = self as NSError
|
||||
switch nsError.code {
|
||||
// NSURLUbiquitousItemDownloadingErrorKey contains an error with this code when the item has not been uploaded to iCloud by the other devices yet
|
||||
case NSUbiquitousFileUnavailableError:
|
||||
return .fileUnavailable
|
||||
// NSURLUbiquitousItemUploadingErrorKey contains an error with this code when the item has not been uploaded to iCloud because it would make the account go over-quota
|
||||
case NSUbiquitousFileNotUploadedDueToQuotaError:
|
||||
return .fileNotUploadedDueToQuota
|
||||
// NSURLUbiquitousItemDownloadingErrorKey and NSURLUbiquitousItemUploadingErrorKey contain an error with this code when connecting to the iCloud servers failed
|
||||
case NSUbiquitousFileUbiquityServerNotAvailable:
|
||||
return .ubiquityServerNotAvailable
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue