Indicate error

This commit is contained in:
Manav Rathi
2024-07-30 14:27:27 +05:30
parent 3eaa9b449a
commit d92a31d8d8

View File

@@ -72,7 +72,13 @@ const IPCResponse = z.object({
* Sibling of the handleMessage function (in `ml-worker.ts`) in the desktop app.
*/
const electronMLWorker = async (type: string, data: string) => {
const port = ensure(_port);
const port = _port;
if (!port) {
throw new Error(
"No MessagePort to communicate with Electron ML worker",
);
}
// Generate a unique nonce to identify this RPC interaction.
const id = Math.random();
return new Promise((resolve) => {