mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
stringify did-fail-load error
directly preload front-logger simplify front-logger
This commit is contained in:
6
index.js
6
index.js
@ -168,7 +168,7 @@ app.once("browser-window-created", (event, win) => {
|
|||||||
frameProcessId,
|
frameProcessId,
|
||||||
frameRoutingId,
|
frameRoutingId,
|
||||||
) => {
|
) => {
|
||||||
const log = {
|
const log = JSON.stringify({
|
||||||
error: "did-fail-load",
|
error: "did-fail-load",
|
||||||
event,
|
event,
|
||||||
errorCode,
|
errorCode,
|
||||||
@ -177,9 +177,9 @@ app.once("browser-window-created", (event, win) => {
|
|||||||
isMainFrame,
|
isMainFrame,
|
||||||
frameProcessId,
|
frameProcessId,
|
||||||
frameRoutingId,
|
frameRoutingId,
|
||||||
};
|
}, null, "\t");
|
||||||
if (is.dev()) {
|
if (is.dev()) {
|
||||||
console.log(log.toString());
|
console.log(log);
|
||||||
}
|
}
|
||||||
win.webContents.send("log", log);
|
win.webContents.send("log", log);
|
||||||
win.webContents.loadFile(path.join(__dirname, "error.html"));
|
win.webContents.loadFile(path.join(__dirname, "error.html"));
|
||||||
|
|||||||
@ -34,8 +34,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
fileExists(songInfoProviderPath, require(songInfoProviderPath));
|
fileExists(songInfoProviderPath, require(songInfoProviderPath));
|
||||||
|
|
||||||
// inject front logger
|
// inject front logger
|
||||||
const loggerPath = path.join(__dirname, "providers", "front-logger.js")
|
require("./providers/front-logger")();
|
||||||
fileExists(loggerPath, require(loggerPath));
|
|
||||||
|
|
||||||
// Add action for reloading
|
// Add action for reloading
|
||||||
global.reload = () =>
|
global.reload = () =>
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
const { ipcRenderer } = require("electron");
|
const { ipcRenderer } = require("electron");
|
||||||
|
|
||||||
function logToString(log) {
|
function logToString(log) {
|
||||||
let string = (typeof log === "string") ? log : log.toString();
|
return (typeof log === "string") ?
|
||||||
if (!string || string.includes("[object Object]")) {
|
log :
|
||||||
string = JSON.stringify(log, null, "\t");
|
JSON.stringify(log, null, "\t");
|
||||||
}
|
|
||||||
return string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user