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:
@@ -85,7 +85,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
self.actionState = .error(.create, error.localizedDescription)
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
self.actionState = .error(.cancel, error.localizedDescription)
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
self.actionState = .error(.uncancel, error.localizedDescription)
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
self.actionState = .error(.markInProgress, error.localizedDescription)
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
self.actionState = .error(.archive, error.localizedDescription)
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
self.actionState = .error(.unarchive, error.localizedDescription)
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
self.actionState = .error(.update, error.localizedDescription)
|
||||
self.errorMessage = error.localizedDescription
|
||||
self.errorMessage = ErrorMessageParser.parse(error.localizedDescription)
|
||||
completion(false)
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ class TaskViewModel: ObservableObject {
|
||||
self.isLoadingCompletions = false
|
||||
}
|
||||
} catch {
|
||||
self.completionsError = error.localizedDescription
|
||||
self.completionsError = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoadingCompletions = false
|
||||
}
|
||||
}
|
||||
@@ -360,7 +360,7 @@ class TaskViewModel: ObservableObject {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
self.tasksError = error.localizedDescription
|
||||
self.tasksError = ErrorMessageParser.parse(error.localizedDescription)
|
||||
self.isLoadingTasks = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user