mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
fix sendError()
This commit is contained in:
@ -10,7 +10,7 @@ const { cropMaxWidth } = require("./utils");
|
||||
const { ACTIONS, CHANNEL } = require("./actions.js");
|
||||
const { getImage } = require("../../providers/song-info");
|
||||
|
||||
const sendError = (err) => {
|
||||
const sendError = (win, err) => {
|
||||
const dialogOpts = {
|
||||
type: "info",
|
||||
buttons: ["OK"],
|
||||
@ -34,7 +34,7 @@ function handle(win) {
|
||||
listenAction(CHANNEL, (event, action, arg) => {
|
||||
switch (action) {
|
||||
case ACTIONS.ERROR: //arg = error
|
||||
sendError(arg);
|
||||
sendError(win, arg);
|
||||
break;
|
||||
case ACTIONS.METADATA:
|
||||
event.returnValue = JSON.stringify(metadata);
|
||||
@ -77,7 +77,7 @@ function handle(win) {
|
||||
writer.addTag();
|
||||
fileBuffer = Buffer.from(writer.arrayBuffer);
|
||||
} catch (error) {
|
||||
sendError(error);
|
||||
sendError(win, error);
|
||||
}
|
||||
|
||||
writeFileSync(filePath, fileBuffer);
|
||||
|
||||
@ -32,7 +32,7 @@ module.exports = (win, options) => {
|
||||
const currentURL = metadataURL || win.webContents.getURL();
|
||||
const playlistID = new URL(currentURL).searchParams.get("list");
|
||||
if (!playlistID) {
|
||||
sendError(new Error("No playlist ID found"));
|
||||
sendError(win, new Error("No playlist ID found"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -46,6 +46,7 @@ module.exports = (win, options) => {
|
||||
const playlistFolder = join(folder, playlistTitle);
|
||||
if (existsSync(playlistFolder)) {
|
||||
sendError(
|
||||
win,
|
||||
new Error(`The folder ${playlistFolder} already exists`)
|
||||
);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user