aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/Files/FilesView.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2025-11-13 11:13:01 -0800
committerDustin Mierau <dustin@mierau.me>2025-11-13 11:13:01 -0800
commit467b53f143a0c3d7328fe85e9d1215eceb9b150a (patch)
treee8db83720021bc9361732d06ff539fcd42d72def /Hotline/macOS/Files/FilesView.swift
parent5818df427f045f3aa54f648a0828c8d997327fbe (diff)
Start surfacing server errors properly to communicate permissions better.
Diffstat (limited to 'Hotline/macOS/Files/FilesView.swift')
-rw-r--r--Hotline/macOS/Files/FilesView.swift16
1 files changed, 10 insertions, 6 deletions
diff --git a/Hotline/macOS/Files/FilesView.swift b/Hotline/macOS/Files/FilesView.swift
index 2386d2a..ab93cbc 100644
--- a/Hotline/macOS/Files/FilesView.swift
+++ b/Hotline/macOS/Files/FilesView.swift
@@ -448,14 +448,14 @@ struct FilesView: View {
@MainActor private func downloadFile(_ file: FileInfo) {
if file.isFolder {
- model.downloadFolder(file.name, path: file.path)
+ self.model.downloadFolder(file.name, path: file.path)
}
else {
- model.downloadFile(file.name, path: file.path)
+ self.model.downloadFile(file.name, path: file.path)
}
}
- @MainActor private func uploadFile(file fileURL: URL, to path: [String]) {
+ @MainActor private func uploadFile(file fileURL: URL, to path: [String]) throws {
self.model.uploadFile(url: fileURL, path: path) { info in
Task {
// Refresh file listing to display newly uploaded file.
@@ -508,9 +508,13 @@ struct FilesView: View {
if file.path.count > 1 {
parentPath = Array(file.path[0..<file.path.count-1])
}
-
- if (try? await model.deleteFile(file.name, path: file.path)) == true {
- let _ = try? await model.getFileList(path: parentPath)
+
+ do {
+ try await self.model.deleteFile(file.name, path: file.path)
+ try await self.model.getFileList(path: parentPath)
+ }
+ catch {
+ print("Error deleting file: \(error)")
}
}
}