fix(flutter): silence 404 log noise from missing playlist covers
Playlist collages aren't generated until the build job runs over a playlist with tracks — system playlists (For-You / Discover / Songs- like) and any newly-created playlist hit a brief window where /api/playlists/:id/cover returns 404. ServerImage's errorWidget already renders the visual fallback (queue_music icon over slate); this fix just keeps cached_network_image from spamming the dev console with HttpExceptionWithStatus stack traces. errorListener filters 404 specifically — auth (401/403) and any 5xx still log so real connectivity / permission issues stay visible. User-visible behavior unchanged; this is a dev-mode log hygiene fix.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:flutter/foundation.dart' show debugPrint;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart'
|
||||||
|
show HttpExceptionWithStatus;
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import '../../auth/auth_provider.dart';
|
import '../../auth/auth_provider.dart';
|
||||||
@@ -71,6 +74,19 @@ class ServerImage extends ConsumerWidget {
|
|||||||
// Keep failures local — a single 401/timeout shouldn't dump
|
// Keep failures local — a single 401/timeout shouldn't dump
|
||||||
// a stack trace or replace the parent Container's background.
|
// a stack trace or replace the parent Container's background.
|
||||||
errorWidget: (_, __, ___) => empty,
|
errorWidget: (_, __, ___) => empty,
|
||||||
|
// Filter expected 404s out of dev console noise: playlist
|
||||||
|
// collages aren't built until the playlist has tracks and
|
||||||
|
// the build job runs (system playlists like For-You /
|
||||||
|
// Discover hit this on first-render). The errorWidget
|
||||||
|
// already renders the fallback for the user; this just
|
||||||
|
// keeps the dev console clean. Non-404 errors still
|
||||||
|
// surface so auth/connectivity issues remain visible.
|
||||||
|
errorListener: (err) {
|
||||||
|
if (err is HttpExceptionWithStatus && err.statusCode == 404) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
debugPrint('ServerImage: $err');
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user