Skip to content

Commit

Permalink
log failed requests with final error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu committed May 9, 2024
1 parent 17917d8 commit a43a46d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/helpers/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<JRPCResponse<ShareRequestResult>>(
Expand Down
4 changes: 4 additions & 0 deletions src/some.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ export class SomeError<T> 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;
Expand Down

0 comments on commit a43a46d

Please sign in to comment.