Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
PrakharDoneria authored Dec 26, 2023
1 parent 189eee2 commit 0701a91
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion home/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -76,6 +80,7 @@ function playSong(index) {
sound.play();
} else {
console.error('Invalid index:', index);
alert('Error: Invalid index. Please try again.');
}
}

Expand Down

0 comments on commit 0701a91

Please sign in to comment.