Less obnoxious error handling

This commit is contained in:
Arkadiusz Fal
2022-12-16 09:35:10 +01:00
parent a9c8053474
commit 4330856c5e
10 changed files with 97 additions and 25 deletions

View File

@@ -1,4 +1,5 @@
import Foundation
import Siesta
import SwiftUI
final class NavigationModel: ObservableObject {
@@ -257,6 +258,11 @@ final class NavigationModel: ObservableObject {
presentingAlert = true
}
func presentRequestErrorAlert(_ error: RequestError) {
let errorDescription = String(format: "Verify you have stable connection with the server you are using (%@)", AccountsModel.shared.current.instance.longDescription)
presentAlert(title: "Connection Error", message: "\(error.userMessage)\n\n\(errorDescription)")
}
func presentAlert(_ alert: Alert) {
self.alert = alert
presentingAlert = true