From 876cee27201ab281471714a4f2df112646802b1b Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 15 Aug 2026 03:08:10 -0700 Subject: [PATCH] Adjust errors and logging. --- src/lib/worker.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/worker.ts b/src/lib/worker.ts index 6d64a75..1412f26 100644 --- a/src/lib/worker.ts +++ b/src/lib/worker.ts @@ -135,11 +135,11 @@ function init (): void { worker.on('message', report) worker.on('error', reset) } - console.log(`nano25519 initialized.`) + console.log(`nano25519/async initialized`) isWorkerReady = true } catch (err: any) { isWorkerReady = false - throw new Error('nano25519 initialization failed') + throw new Error('nano25519/async initialization failed') } } @@ -163,8 +163,7 @@ function report (msg: { data: Record }): void { const { result } = data console.log('received result from worker') if (typeof result !== 'boolean' && typeof result !== 'string' && !isBytes(result)) { - console.error(result) - return err('Invalid return type') + return err(`expected boolean, string, or bytes; received ${result?.constructor?.name ?? typeof result} '${result}`) } return ok(result) } @@ -201,7 +200,6 @@ async function dispatch (data: Record<'action', Action> & Record { tasks.set(id, [resolve, reject]) - console.log('tasks', tasks) post(id, data, transfer) }) } -- 2.52.0