Improve storage, paths
This commit is contained in:
33
CHDataManagement/Storage/StorageAccessError.swift
Normal file
33
CHDataManagement/Storage/StorageAccessError.swift
Normal file
@ -0,0 +1,33 @@
|
||||
import Foundation
|
||||
|
||||
enum StorageAccessError: Error {
|
||||
|
||||
case noBookmarkData
|
||||
|
||||
case bookmarkDataCorrupted(Error)
|
||||
|
||||
case folderAccessFailed(URL)
|
||||
|
||||
case stringConversionFailed
|
||||
|
||||
case fileNotFound(String)
|
||||
|
||||
}
|
||||
|
||||
extension StorageAccessError: CustomStringConvertible {
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .noBookmarkData:
|
||||
return "No bookmark data to access resources in folder"
|
||||
case .bookmarkDataCorrupted(let error):
|
||||
return "Failed to resolve bookmark: \(error)"
|
||||
case .folderAccessFailed(let url):
|
||||
return "Failed to access folder: \(url.path())"
|
||||
case .stringConversionFailed:
|
||||
return "Failed to convert string to data"
|
||||
case .fileNotFound(let path):
|
||||
return "File not found: \(path)"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user