Show message box when error occurs on RPC connection

This commit is contained in:
Agampreet Singh
2022-09-24 23:21:53 +05:30
parent 4a1bac260b
commit 8eb12469a3

16
main.js
View File

@@ -589,11 +589,15 @@ app.on("ready", function () {
});
});
autoUpdater.checkForUpdatesAndNotify();
rpc
.login({ clientId })
.catch(() =>
console.error(
"Oops! An Error occured while connecting to Discord RPC. Probably discord isn't installed or opened?"
)
if (store.get("discordrpcstatus") === "true") {
rpc.login({ clientId }).catch(() =>
dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
type: "error",
title: "Discord RPC Error",
message:
"Oops! An Error occured while connecting to Discord RPC. Probably discord isn't installed or opened?",
buttons: ["OK"],
})
);
}
});