Skip to content

Commit

Permalink
Merge pull request #151 from zama-ai/betterError
Browse files Browse the repository at this point in the history
feat: better error log
  • Loading branch information
jatZama authored Dec 14, 2024
2 parents 2b1ec8d + 3344021 commit 02051eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sdk/reencrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ export const reencryptRequest =
const acl = new ethers.Contract(aclContractAddress, aclABI, provider);
const userAllowed = await acl.persistAllowed(handle, userAddress);
const contractAllowed = await acl.persistAllowed(handle, contractAddress);
const isAllowed = userAllowed && contractAllowed;
if (!isAllowed) {
if (!userAllowed) {
throw new Error('User is not authorized to reencrypt this handle!');
}
if (!contractAllowed) {
throw new Error(
'dApp contract is not authorized to reencrypt this handle!',
);
}
if (userAddress === contractAddress) {
throw new Error(
'userAddress should not be equal to contractAddress when requesting reencryption!',
Expand Down

0 comments on commit 02051eb

Please sign in to comment.