Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

desktop: handle unhandled errors

Abdullah Attae6f4aea4d772
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index b69bf73d9..a62e737d0 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -53,6 +53,13 @@ if (process.platform === "win32") {
app.setAppUserModelId(app.name);
}
+process.on("uncaughtException", (error) => {
+ console.error("uncaughtException:", error);
+});
+process.on("unhandledRejection", (reason) => {
+ console.error("unhandledRejection:", reason);
+});
+
app.commandLine.appendSwitch("lang", "en-US");
async function createWindow() {
diff --git a/apps/desktop/src/utils/protocol.ts b/apps/desktop/src/utils/protocol.ts
index b4ca93326..da3d46061 100644
--- a/apps/desktop/src/utils/protocol.ts
+++ b/apps/desktop/src/utils/protocol.ts
@@ -62,14 +62,9 @@ function registerProtocol() {
headers: { "Content-Type": extensionToMimeType[fileExtension] }
});
} else {
- try {
- return net.fetch(request, {
- bypassCustomProtocolHandlers: true
- });
- } catch (e) {
- console.error(e);
- }
- return Response.error();
+ return net.fetch(request, {
+ bypassCustomProtocolHandlers: true
+ });
}
});
console.info(`${SCHEME} protocol inteception "successful"`);