refactor: organize desktop vs. mobile into separate folders

This commit is contained in:
Arjun Patel
2026-04-29 08:42:56 -07:00
parent 3d9fe67936
commit 3a11a82cd3
194 changed files with 213 additions and 213 deletions
+23
View File
@@ -0,0 +1,23 @@
import { ipcMain, type IpcMainInvokeEvent } from "electron";
import { reportError } from "@/lib/errors";
type InvokeHandler = (
event: IpcMainInvokeEvent,
...args: unknown[]
) => Promise<unknown> | unknown;
/**
* Wraps `ipcMain.handle` so handler failures log with full stack in main and
* re-throw a sanitized message to the renderer.
*/
export function safeHandle(channel: string, handler: InvokeHandler): void {
ipcMain.handle(channel, async (event, ...args) => {
try {
return await handler(event, ...(args as unknown[]));
} catch (err) {
reportError(err, { scope: `ipc.${channel}` });
const message = err instanceof Error ? err.message : "IPC error";
throw new Error(message);
}
});
}