Updates older ToastView code to use error initializer

This commit is contained in:
Riley Testut
2020-03-30 14:07:18 -07:00
parent 4d75116c2d
commit 162139d52b
5 changed files with 27 additions and 21 deletions

View File

@@ -180,12 +180,14 @@ private extension BrowseViewController
self.loadingState = .finished(.success(()))
}
}
catch
catch let error as NSError
{
DispatchQueue.main.async {
if self.dataSource.itemCount > 0
{
let toastView = ToastView(text: NSLocalizedString("Failed to Fetch Sources", comment: ""), detailText: error.localizedDescription)
let error = error.withLocalizedFailure(NSLocalizedString("Failed to Fetch Sources", comment: ""))
let toastView = ToastView(error: error)
toastView.show(in: self)
}