Skip to content

Commit

Permalink
Merge pull request #142 from torusresearch/fix/err-msgs
Browse files Browse the repository at this point in the history
fix error msgs
  • Loading branch information
chaitanyapotti authored May 9, 2024
2 parents ebbd343 + 915d963 commit f947fd2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/helpers/nodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export async function retrieveOrImportShare(params: {
}
}

return Promise.reject(new Error(`invalid ${JSON.stringify(resultArr)}`));
return Promise.reject(new Error(`invalid commitment results ${JSON.stringify(resultArr)}`));
})
.then((responses) => {
const promiseArrRequest: Promise<void | JRPCResponse<ShareRequestResult>>[] = [];
Expand Down Expand Up @@ -482,7 +482,7 @@ export async function retrieveOrImportShare(params: {
throw new Error(`Insufficient number of session tokens from nodes, required: ${minThreshold}, found: ${validTokens.length}`);
}
sessionTokensResolved.forEach((x, index) => {
if (!x) sessionTokenData.push(undefined);
if (!x || !sessionSigsResolved[index]) sessionTokenData.push(undefined);
else
sessionTokenData.push({
token: x.toString("base64"),
Expand Down Expand Up @@ -541,7 +541,13 @@ export async function retrieveOrImportShare(params: {
serverTimeOffsetResponse: serverTimeOffset || calculateMedian(serverOffsetTimes),
};
}
throw new Error("Invalid");

if (completedRequests.length < thresholdReqCount) {
throw new Error(`Waiting for results from more nodes, pending: ${thresholdReqCount - completedRequests.length}`);
}
throw new Error(
`Invalid results, threshold pub key: ${thresholdPublicKey}, nonce data found: ${!!thresholdNonceData}, extended verifierId: ${verifierParams.extended_verifier_id}`
);
});
})
.then(async (res) => {
Expand Down

0 comments on commit f947fd2

Please sign in to comment.