Skip to content

Commit 8e43e34

Browse files
committed
Handle isContractDeployed error on contract page (#5165)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on improving error handling when checking if a contract is deployed. It ensures that if the contract check fails, it will not throw an error but instead return `false`. ### Detailed summary - Modified `isValidContract` assignment to handle errors gracefully by using `.catch(() => false)` instead of letting the promise reject. - Ensured that the flow continues to call `notFound()` if the contract is not valid. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 74e52c0 commit 8e43e34

File tree

1 file changed

+1
-1
lines changed
  • apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]

1 file changed

+1
-1
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default async function Layout(props: {
3939
}
4040

4141
// check if the contract exists
42-
const isValidContract = await isContractDeployed(contract);
42+
const isValidContract = await isContractDeployed(contract).catch(() => false);
4343
if (!isValidContract) {
4444
// TODO - replace 404 with a better page to upsale deploy or other thirdweb products
4545
notFound();

0 commit comments

Comments
 (0)