Improve error message handling with user-friendly messages
- Add ErrorMessageParser in Kotlin and Swift to detect network errors and technical messages, replacing them with human-readable text - Update all ViewModels to use ErrorMessageParser.parse() for error display - Remove redundant error popup from LoginView (error shows inline only) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,7 @@ struct ManageUsersView: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoading = false
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ struct ManageUsersView: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isGeneratingCode = false
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ struct ManageUsersView: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ private extension ResidenceDetailView {
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
self.isDeleting = false
|
||||
self.viewModel.errorMessage = error.localizedDescription
|
||||
self.viewModel.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -500,7 +500,7 @@ private extension ResidenceDetailView {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
self.contractorsError = error.localizedDescription
|
||||
self.contractorsError = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoadingContractors = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ class ResidenceSharingManager: ObservableObject {
|
||||
completion(false)
|
||||
}
|
||||
} catch {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isImporting = false
|
||||
completion(false)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class ResidenceViewModel: ObservableObject {
|
||||
}
|
||||
self.isLoading = false
|
||||
} catch {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoading = false
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class ResidenceViewModel: ObservableObject {
|
||||
self.isLoading = false
|
||||
}
|
||||
} catch {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoading = false
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class ResidenceViewModel: ObservableObject {
|
||||
self.isLoading = false
|
||||
}
|
||||
} catch {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoading = false
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class ResidenceViewModel: ObservableObject {
|
||||
} catch {
|
||||
print("🏠 ResidenceVM: Exception: \(error)")
|
||||
await MainActor.run {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoading = false
|
||||
completion(nil)
|
||||
}
|
||||
@@ -205,7 +205,7 @@ class ResidenceViewModel: ObservableObject {
|
||||
completion(false)
|
||||
}
|
||||
} catch {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoading = false
|
||||
completion(false)
|
||||
}
|
||||
@@ -228,7 +228,7 @@ class ResidenceViewModel: ObservableObject {
|
||||
self.isGeneratingReport = false
|
||||
}
|
||||
} catch {
|
||||
self.reportMessage = error.localizedDescription
|
||||
self.reportMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isGeneratingReport = false
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ class ResidenceViewModel: ObservableObject {
|
||||
completion(false)
|
||||
}
|
||||
} catch {
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoading = false
|
||||
completion(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user