fix(ui): sanitize user-facing errors

This commit is contained in:
zarzet
2026-07-29 01:43:04 +07:00
parent b1c18b95e7
commit 662558e3e6
31 changed files with 451 additions and 100 deletions
+1 -1
View File
@@ -584,7 +584,7 @@ class _AudioAnalysisCardState extends State<AudioAnalysisCard> {
} catch (e) {
if (mounted) {
setState(() {
_error = e.toString();
_error = context.friendlyError(e);
_analyzing = false;
});
}
+5 -1
View File
@@ -11,6 +11,7 @@ class ErrorCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final displayError = context.friendlyError(error);
final isRateLimit =
error.contains('429') ||
error.toLowerCase().contains('rate limit') ||
@@ -66,7 +67,10 @@ class ErrorCard extends StatelessWidget {
Icon(Icons.error_outline, color: colorScheme.error),
const SizedBox(width: 12),
Expanded(
child: Text(error, style: TextStyle(color: colorScheme.error)),
child: Text(
displayError,
style: TextStyle(color: colorScheme.error),
),
),
],
),