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