Skip to content

Commit

Permalink
Handle isContractDeployed error on contract page (#5165)
Browse files Browse the repository at this point in the history
## 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 -->
  • Loading branch information
MananTank committed Oct 24, 2024
1 parent 74e52c0 commit 8e43e34
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default async function Layout(props: {
}

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

0 comments on commit 8e43e34

Please sign in to comment.