Skip to content

Commit

Permalink
Merge pull request #401 from jordanlesich/propogateErrMsgs
Browse files Browse the repository at this point in the history
Propagate Error Messages to View
  • Loading branch information
jordanlesich authored Oct 31, 2023
2 parents c1772c4 + 7dd9cd2 commit cd37d27
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
5 changes: 5 additions & 0 deletions apps/web/src/data/subgraph/requests/dashboardQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ export const dashboardRequest = async (memberAddress: string) => {
console.error(e)
Sentry.captureException(e)
await Sentry.flush(2000)
throw new Error(
e?.message
? `Goldsky Request Error: ${e.message}`
: 'Error fetching dashboard data from Goldsky subgraph.'
)
}
}
43 changes: 26 additions & 17 deletions apps/web/src/modules/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,29 @@ export type DashboardDaoProps = DaoFragment & {
}

const fetchDaoProposalState = async (dao: DashboardDaoProps) => {
const proposals = await Promise.all(
dao.proposals.map(async (proposal) => {
const proposalState = await getProposalState(
dao.chainId,
proposal.dao.governorAddress,
proposal.proposalId
)
return { ...proposal, proposalState: proposalState }
})
)
return {
...dao,
proposals: proposals.filter((proposal) =>
ACTIVE_PROPOSAL_STATES.includes(proposal.proposalState)
),
try {
const proposals = await Promise.all(
dao.proposals.map(async (proposal) => {
const proposalState = await getProposalState(
dao.chainId,
proposal.dao.governorAddress,
proposal.proposalId
)
return { ...proposal, proposalState: proposalState }
})
)
return {
...dao,
proposals: proposals.filter((proposal) =>
ACTIVE_PROPOSAL_STATES.includes(proposal.proposalState)
),
}
} catch (error: any) {
throw new Error(
error?.message
? `RPC Error: ${error.message}`
: 'Error fetch Dashboard data from RPC'
)
}
}

Expand All @@ -70,9 +78,10 @@ const fetchDashboardData = async (address: string) => {
const userDaos = (await dashboardRequest(address)) as unknown as DashboardDaoProps[]
if (!userDaos) throw new Error('Dashboard DAO query returned undefined')
const resolved = await Promise.all(userDaos.map(fetchDaoProposalState))

return resolved
} catch (error) {
throw new Error('Error fetching dashboard data')
} catch (error: any) {
throw new Error(error?.message || 'Error fetching dashboard data')
}
}

Expand Down

2 comments on commit cd37d27

@vercel
Copy link

@vercel vercel bot commented on cd37d27 Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

testnet-nouns-builder – ./apps/web

testnet-nouns-builder-nouns-builder.vercel.app
testnet.nouns.build
testnet-nouns-builder-git-main-nouns-builder.vercel.app

@vercel
Copy link

@vercel vercel bot commented on cd37d27 Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.