mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 13:53:37 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user