From a43a46da7d738bb5abc8422a5bdac0e0b3234932 Mon Sep 17 00:00:00 2001 From: himanshu Date: Thu, 9 May 2024 21:28:49 +0530 Subject: [PATCH] log failed requests with final error msg --- src/helpers/nodeUtils.ts | 6 ++---- src/some.ts | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/helpers/nodeUtils.ts b/src/helpers/nodeUtils.ts index 2df03f8..735fa1c 100644 --- a/src/helpers/nodeUtils.ts +++ b/src/helpers/nodeUtils.ts @@ -208,9 +208,7 @@ export async function retrieveOrImportShare(params: { }), null, { logTracingHeader: config.logRequestTracing } - ).catch((err) => { - log.error("commitment error", err); - }); + ); promiseArr.push(p); } // send share request once k + t number of commitment requests have completed @@ -294,7 +292,7 @@ export async function retrieveOrImportShare(params: { }), null, { logTracingHeader: config.logRequestTracing } - ).catch((err) => log.error("share req", err)); + ); promiseArrRequest.push(p); } else { const p = post>( diff --git a/src/some.ts b/src/some.ts index b16e8b2..ca72333 100644 --- a/src/some.ts +++ b/src/some.ts @@ -10,9 +10,13 @@ export class SomeError extends Error { predicate: string; constructor({ errors, responses, predicate }: { errors: Error[]; responses: T[]; predicate: string }) { + // its fine to log responses in errors logs for better debugging, + // as data is always encrypted with temp key + // temp key should not be logged anywhere const message = `Unable to resolve enough promises. errors: ${errors.map((x) => x?.message || x).join(", ")}, ${responses.length} responses, + responses: ${JSON.stringify(responses)}, predicate error: ${predicate}`; super(message); this.errors = errors;