mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
catch errors in downloadSong()
This commit is contained in:
@ -59,7 +59,7 @@ const sendError = (error) => {
|
||||
buttons: ["OK"],
|
||||
title: "Error in download!",
|
||||
message: "Argh! Apologies, download failed…",
|
||||
detail: error.toString(),
|
||||
detail: `${error.toString()} ${error.cause ? `\n\n${error.cause.toString()}` : ''}`,
|
||||
});
|
||||
};
|
||||
|
||||
@ -89,6 +89,19 @@ async function downloadSong(
|
||||
playlistFolder = undefined,
|
||||
trackId = undefined,
|
||||
increasePlaylistProgress = () => {},
|
||||
) {
|
||||
try {
|
||||
await downloadSongUnsafe(url, playlistFolder, trackId, increasePlaylistProgress);
|
||||
} catch (error) {
|
||||
sendError(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadSongUnsafe(
|
||||
url,
|
||||
playlistFolder = undefined,
|
||||
trackId = undefined,
|
||||
increasePlaylistProgress = () => {},
|
||||
) {
|
||||
const sendFeedback = (message, progress) => {
|
||||
if (!playlistFolder) {
|
||||
|
||||
Reference in New Issue
Block a user