diff --git a/apps/web/src/data/subgraph/requests/dashboardQuery.ts b/apps/web/src/data/subgraph/requests/dashboardQuery.ts index edc36688d..34d92b67e 100644 --- a/apps/web/src/data/subgraph/requests/dashboardQuery.ts +++ b/apps/web/src/data/subgraph/requests/dashboardQuery.ts @@ -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.' + ) } } diff --git a/apps/web/src/modules/dashboard/Dashboard.tsx b/apps/web/src/modules/dashboard/Dashboard.tsx index af22b0f74..d10295cd6 100644 --- a/apps/web/src/modules/dashboard/Dashboard.tsx +++ b/apps/web/src/modules/dashboard/Dashboard.tsx @@ -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' + ) } } @@ -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') } }