From a7ab70d953b0d47e369ce8a2a1e93828bbcfc9a4 Mon Sep 17 00:00:00 2001 From: Ashutosh Nayak Date: Mon, 22 Jan 2024 19:17:47 +0530 Subject: [PATCH] updated to handle missing song lyrics --- lib/services/queries/lyrics.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/services/queries/lyrics.dart b/lib/services/queries/lyrics.dart index faa5bdec..060f64b7 100644 --- a/lib/services/queries/lyrics.dart +++ b/lib/services/queries/lyrics.dart @@ -48,7 +48,9 @@ class LyricsQueries { throw "No track currently"; } final timedLyrics = await ServiceUtils.getTimedLyrics(track); - if (timedLyrics == null) throw Exception("Unable to find lyrics"); + if (timedLyrics == null) { + return SubtitleSimple(errorMessage: "Unable to find lyrics"); + } return timedLyrics; }, @@ -83,8 +85,8 @@ class LyricsQueries { }); if (res.statusCode != 200) { - throw Exception("Unable to find lyrics"); - } + return SubtitleSimple(errorMessage: "Unable to find lyrics"); + } final linesRaw = Map.castFrom( jsonDecode(res.body), )["lyrics"]?["lines"] as List?;