Skip to content

Commit

Permalink
Fix error message rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
malliina committed Nov 24, 2024
1 parent 871101d commit 0b7203a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion MusicPimp/LibraryList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ struct LibraryListInternal<T, D>: View where T: LibraryVMLike, D: DownloaderLike
.task {
switch vm.appearAction {
case .Reload:
await vm.load()
// Sometimes this .task is triggered twice, cancelling the previous one inadvertently, so as a workaround, load in a detached task
Task {
await vm.load()
}
case .Dismiss:
dismiss()
case .Noop:
Expand Down
7 changes: 6 additions & 1 deletion MusicPimp/PimpViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func outcomeView<T, A>(outcome: Outcome<T>, @ViewBuilder render: (T) -> A) -> so
case .Loaded(let t):
render(t)
case .Err(let error):
fullSizeText("Error. \(error)")
let message = switch error {
case let err as PimpError: err.message
case _ as URLError: "A network error occurred."
default: "An error occurred."
}
fullSizeText(message)
}
}

0 comments on commit 0b7203a

Please sign in to comment.