Show a fixed, generic message for fetch errors instead of e.message
Exceptions from the HTTP client or JSON parsing can carry verbose, technical text (full response bodies, stack traces) — not meaningful to a user seeing it as a red error banner. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
@@ -169,11 +169,14 @@ class PriceViewModel(
|
||||
newRates,
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// Not localized: this shared ViewModel has no platform Context to resolve a moko-resources
|
||||
// string on Android, and no locale-aware synchronous resolution path that works everywhere.
|
||||
} catch (_: Exception) {
|
||||
// A fixed, generic message rather than e.message: exceptions from the HTTP client
|
||||
// or JSON parsing can carry verbose, technical text (full response bodies, stack
|
||||
// traces) that isn't meaningful to a user. Not localized: this shared ViewModel has
|
||||
// no platform Context to resolve a moko-resources string on Android, and no
|
||||
// locale-aware synchronous resolution path that works everywhere.
|
||||
_uiState.update {
|
||||
it.copy(isLoading = false, errorMessage = e.message ?: "Could not fetch exchange rates")
|
||||
it.copy(isLoading = false, errorMessage = "Could not fetch exchange rates")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user