From 0701a91953df9b2a9dd438d460a284add094d635 Mon Sep 17 00:00:00 2001 From: Prakhar Doneria Date: Tue, 26 Dec 2023 16:36:04 +0530 Subject: [PATCH] Update script.js --- home/script.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/home/script.js b/home/script.js index 9e399b7..2cd0db2 100644 --- a/home/script.js +++ b/home/script.js @@ -40,9 +40,13 @@ function fetchTopTracks() { playSong(currentSongIndex); } else { console.error('No top tracks found.'); + alert('Error: No top tracks found.'); } }) - .catch(error => console.error('Error fetching top tracks from Last.fm:', error)); + .catch(error => { + console.error('Error fetching top tracks from Last.fm:', error); + alert('Error fetching top tracks. Please try again.'); + }); } function playSong(index) { @@ -76,6 +80,7 @@ function playSong(index) { sound.play(); } else { console.error('Invalid index:', index); + alert('Error: Invalid index. Please try again.'); } }