diff options
author | Florian Dold <florian@dold.me> | 2022-09-30 13:11:17 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-09-30 13:11:17 +0200 |
commit | 0a3f9979b201f4fc0c17bfeef370048f37f25611 (patch) | |
tree | 3d509ccab9927bb85c5c1104e810e81c5e7412d3 /packages/taler-wallet-webextension/src/browserWorkerEntry.ts | |
parent | 538f27e9dd5f55004e1fd1849ec7939afbec5c88 (diff) | |
download | wallet-core-0a3f9979b201f4fc0c17bfeef370048f37f25611.tar.xz |
firefox hotfixv0.9.0-dev.27
Diffstat (limited to 'packages/taler-wallet-webextension/src/browserWorkerEntry.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/browserWorkerEntry.ts | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/packages/taler-wallet-webextension/src/browserWorkerEntry.ts b/packages/taler-wallet-webextension/src/browserWorkerEntry.ts index 1b6cfc455..2f1a26e36 100644 --- a/packages/taler-wallet-webextension/src/browserWorkerEntry.ts +++ b/packages/taler-wallet-webextension/src/browserWorkerEntry.ts @@ -22,8 +22,11 @@ * Imports. */ -import { Logger } from "@gnu-taler/taler-util"; -import { nativeCrypto } from "@gnu-taler/taler-wallet-core"; +import { j2s, Logger } from "@gnu-taler/taler-util"; +import { + getErrorDetailFromException, + nativeCrypto, +} from "@gnu-taler/taler-wallet-core"; const logger = new Logger("browserWorkerEntry.ts"); @@ -41,13 +44,22 @@ async function handleRequest( return; } + logger.info(`browser worker crypto request: ${j2s(req)}`); + + let responseMsg: any; try { - const result = await (impl as any)[operation](req); - worker.postMessage({ result, id }); - } catch (e) { - logger.error("error during operation", e); - return; + const result = await (impl as any)[operation](impl, req); + responseMsg = { type: "success", result, id }; + } catch (e: any) { + logger.error(`error during operation: ${e.stack ?? e.toString()}`); + responseMsg = { + type: "error", + id, + error: getErrorDetailFromException(e), + }; } + + worker.postMessage(responseMsg); } worker.onmessage = (msg: MessageEvent) => { |