From 3344021ee5869cc0bdad1c3e0fe4126ae9102996 Mon Sep 17 00:00:00 2001 From: jatZama Date: Sat, 14 Dec 2024 17:27:45 +0100 Subject: [PATCH] feat: better error log chore: prettier --- src/sdk/reencrypt.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sdk/reencrypt.ts b/src/sdk/reencrypt.ts index bb58e8f..6ee4641 100644 --- a/src/sdk/reencrypt.ts +++ b/src/sdk/reencrypt.ts @@ -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!',