Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/app/data/morpho/mappers/mapNetApyData/cNetApyData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ export function cNetApyData(vaultState: FullVaultInfoQuery["vaultByAddress"]["st
const key = reward.asset.address;
const apr = reward.supplyApr;
if (apr == null) {
console.error("reward.supplyApr is null", reward);
throw new Error("reward.supplyApr is null");
console.error(`reward.supplyApr is null for ${reward.asset.symbol}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually think the issue here is we are calling this function somewhere where it is not wrapped in a react-query hook or function, which has a built in try/catch and error display logic. So the throwing of the error is good, since the function requires this value to do the sum (otherwise we are silently providing invalid sum technically)

Copy link
Contributor

Choose a reason for hiding this comment

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

I will log a bug in the backlog for this

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah I see - should we close this for now then? feel free to if you think yes

} else {
rewardsMap.set(key, {
asset: reward.asset,
totalApr: apr,
});
totalRewards += apr;
}

rewardsMap.set(key, {
asset: reward.asset,
totalApr: apr,
});
totalRewards += apr;
}
}

Expand Down