diff options
author | Florian Dold <florian@dold.me> | 2023-05-28 17:48:18 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-05-28 17:48:18 +0200 |
commit | d4dd82eda110b165e62f451bb1bad65a2c9963d5 (patch) | |
tree | 7eb7bd412c8982086c1aab2ba2250e6030aecef4 /packages | |
parent | f5f3d3e23cac9c425c20019cb89baa212154f2ed (diff) | |
download | wallet-core-d4dd82eda110b165e62f451bb1bad65a2c9963d5.tar.xz |
taler-wallet-embedded: improve awkward log message
Diffstat (limited to 'packages')
-rw-r--r-- | packages/taler-wallet-embedded/src/wallet-qjs.ts | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/packages/taler-wallet-embedded/src/wallet-qjs.ts b/packages/taler-wallet-embedded/src/wallet-qjs.ts index 8dca034d7..57452301f 100644 --- a/packages/taler-wallet-embedded/src/wallet-qjs.ts +++ b/packages/taler-wallet-embedded/src/wallet-qjs.ts @@ -183,26 +183,21 @@ export function installNativeWalletListener(): void { const id = msg.id; logger.info(`native listener: got request for ${operation} (${id})`); + let respMsg: CoreApiResponse; try { - const respMsg = await handler.handleMessage( - operation, - id, - msg.args ?? {}, - ); - logger.info( - `native listener: sending ${respMsg.type} response for ${operation} (${id})`, - ); - sendNativeMessage(respMsg); + respMsg = await handler.handleMessage(operation, id, msg.args ?? {}); } catch (e) { - const respMsg: CoreApiResponse = { + respMsg = { type: "error", id, operation, error: getErrorDetailFromException(e), }; - sendNativeMessage(respMsg); - return; } + logger.info( + `native listener: sending back ${respMsg.type} message for operation ${operation} (${id})`, + ); + sendNativeMessage(respMsg); }; qjsOs.setMessageFromHostHandler((m) => onMessage(m)); |