[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: fix: missing crypto error han
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: fix: missing crypto error handling improvement |
Date: |
Wed, 28 Sep 2022 18:15:39 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 7ce1cea1c fix: missing crypto error handling improvement
7ce1cea1c is described below
commit 7ce1cea1c77f690b038d559a4533bc82e27c33ad
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Sep 28 13:15:31 2022 -0300
fix: missing crypto error handling improvement
---
.../src/crypto/workers/synchronousWorkerWeb.ts | 30 ++++++++++++++--------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git
a/packages/taler-wallet-core/src/crypto/workers/synchronousWorkerWeb.ts
b/packages/taler-wallet-core/src/crypto/workers/synchronousWorkerWeb.ts
index cbf1e19f7..22fd0d96b 100644
--- a/packages/taler-wallet-core/src/crypto/workers/synchronousWorkerWeb.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/synchronousWorkerWeb.ts
@@ -15,6 +15,7 @@
*/
import { Logger } from "@gnu-taler/taler-util";
+import { getErrorDetailFromException } from "../../errors.js";
import {
nativeCryptoR,
TalerCryptoInterfaceR,
@@ -60,7 +61,7 @@ export class SynchronousCryptoWorker {
private dispatchMessage(msg: any): void {
if (this.onmessage) {
- this.onmessage({ data: msg });
+ this.onmessage(msg);
}
}
@@ -72,20 +73,27 @@ export class SynchronousCryptoWorker {
const impl = this.cryptoImplR;
if (!(operation in impl)) {
- console.error(`crypto operation '${operation}' not found`);
+ logger.error(`crypto operation '${operation}' not found`);
return;
}
- let result: any;
+ let responseMsg: any;
try {
- result = await (impl as any)[operation](impl, req);
+ const result = await (impl as any)[operation](impl, req);
+ responseMsg = { data: { type: "success", result, id } };
} catch (e: any) {
- logger.error(`error during operation '${operation}': ${e}`);
- return;
+ logger.error(`error during operation: ${e.stack ?? e.toString()}`);
+ responseMsg = {
+ data: {
+ type: "error",
+ id,
+ error: getErrorDetailFromException(e),
+ },
+ };
}
try {
- setTimeout(() => this.dispatchMessage({ result, id }), 0);
+ setTimeout(() => this.dispatchMessage(responseMsg), 0);
} catch (e) {
logger.error("got error during dispatch", e);
}
@@ -97,22 +105,22 @@ export class SynchronousCryptoWorker {
postMessage(msg: any): void {
const req = msg.req;
if (typeof req !== "object") {
- console.error("request must be an object");
+ logger.error("request must be an object");
return;
}
const id = msg.id;
if (typeof id !== "number") {
- console.error("RPC id must be number");
+ logger.error("RPC id must be number");
return;
}
const operation = msg.operation;
if (typeof operation !== "string") {
- console.error("RPC operation must be string");
+ logger.error("RPC operation must be string");
return;
}
this.handleRequest(operation, id, req).catch((e) => {
- console.error("Error while handling crypto request:", e);
+ logger.error("Error while handling crypto request:", e);
});
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: fix: missing crypto error handling improvement,
gnunet <=