From: Chris Duncan Date: Sat, 15 Aug 2026 10:08:10 +0000 (-0700) Subject: Adjust errors and logging. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=876cee27201ab281471714a4f2df112646802b1b;p=nano25519.git Adjust errors and logging. --- 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) }) }