From 467b53f143a0c3d7328fe85e9d1215eceb9b150a Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Thu, 13 Nov 2025 11:13:01 -0800 Subject: Start surfacing server errors properly to communicate permissions better. --- Hotline/Hotline/HotlineClient.swift | 10 +++------- Hotline/State/HotlineState.swift | 32 +++++++++++++++++++++++--------- Hotline/macOS/Files/FilesView.swift | 16 ++++++++++------ Hotline/macOS/Files/FolderItemView.swift | 4 ++-- Hotline/macOS/ServerView.swift | 7 ++++++- 5 files changed, 44 insertions(+), 25 deletions(-) diff --git a/Hotline/Hotline/HotlineClient.swift b/Hotline/Hotline/HotlineClient.swift index 8d0e870..7305a2f 100644 --- a/Hotline/Hotline/HotlineClient.swift +++ b/Hotline/Hotline/HotlineClient.swift @@ -429,6 +429,7 @@ public actor HotlineClient { } catch is TaskTimeoutError { throw HotlineClientError.timeout } catch let error as HotlineClientError { + print("Hotline Client Error: \(error)") throw error } catch { throw error @@ -651,17 +652,12 @@ public actor HotlineClient { /// - name: File or folder name /// - path: Directory path containing the item /// - Returns: True if deletion succeeded - public func deleteFile(name: String, path: [String]) async throws -> Bool { + public func deleteFile(name: String, path: [String]) async throws { var transaction = HotlineTransaction(id: self.generateTransactionID(), type: .deleteFile) transaction.setFieldString(type: .fileName, val: name) transaction.setFieldPath(type: .filePath, val: path) - do { - try await self.sendTransaction(transaction) - return true - } catch { - return false - } + try await self.sendTransaction(transaction) } /// Create a folder diff --git a/Hotline/State/HotlineState.swift b/Hotline/State/HotlineState.swift index 627b6a0..1f8e2e5 100644 --- a/Hotline/State/HotlineState.swift +++ b/Hotline/State/HotlineState.swift @@ -799,7 +799,7 @@ class HotlineState: Equatable { self.users = hotlineUsers.map { User(hotlineUser: $0) } } - // MARK: - Files (Basic) + // MARK: - Files @MainActor @discardableResult @@ -856,7 +856,7 @@ class HotlineState: Equatable { } @MainActor - func deleteFile(_ fileName: String, path: [String]) async throws -> Bool { + func deleteFile(_ fileName: String, path: [String]) async throws { guard let client = self.client else { throw HotlineClientError.notConnected } @@ -865,14 +865,16 @@ class HotlineState: Equatable { if path.count > 1 { fullPath = Array(path[0.. 1 { parentPath = Array(file.path[0..