Improve storage, paths

This commit is contained in:
Christoph Hagen
2024-12-16 21:01:38 +01:00
parent b22b76fd32
commit 849585acc7
19 changed files with 393 additions and 268 deletions

View 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)"
}
}
}