From 6efb3159d5c434736eb354aae639847762111a99 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 14 May 2026 08:32:35 -0400 Subject: [PATCH] fix(flutter): silence 404 log noise from missing playlist covers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../lib/shared/widgets/server_image.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/flutter_client/lib/shared/widgets/server_image.dart b/flutter_client/lib/shared/widgets/server_image.dart index 88d07c4d..47af8517 100644 --- a/flutter_client/lib/shared/widgets/server_image.dart +++ b/flutter_client/lib/shared/widgets/server_image.dart @@ -1,5 +1,8 @@ import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/foundation.dart' show debugPrint; import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart' + show HttpExceptionWithStatus; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../auth/auth_provider.dart'; @@ -71,6 +74,19 @@ class ServerImage extends ConsumerWidget { // Keep failures local — a single 401/timeout shouldn't dump // a stack trace or replace the parent Container's background. 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'); + }, ); }, );