mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-05 18:48:38 +02:00
fix(ui): sanitize user-facing errors
This commit is contained in:
@@ -584,7 +584,7 @@ class _AudioAnalysisCardState extends State<AudioAnalysisCard> {
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_error = e.toString();
|
||||
_error = context.friendlyError(e);
|
||||
_analyzing = false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user