Skip to content

Commit

Permalink
fix: log detailed error information when fetching token decimals
Browse files Browse the repository at this point in the history
Include error object in log for better debugging of failed token decimals retrieval.
  • Loading branch information
gentlementlegen committed Oct 10, 2024
1 parent dad03a1 commit ed6810c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/handlers/generate-erc20-permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ async function getTokenDecimals(tokenAddress: string, provider: ethers.providers
const tokenContract = new ethers.Contract(tokenAddress, erc20Abi, provider);
return await tokenContract.decimals();
} catch (error) {
const errorMessage = `Failed to get token decimals for token: ${tokenAddress}`;
logger.debug(errorMessage);
const errorMessage = `Failed to get token decimals for token: ${tokenAddress}, ${error}`;
logger.debug(errorMessage, { error });
throw new Error(errorMessage);
}
}

0 comments on commit ed6810c

Please sign in to comment.