Skip to content

Commit

Permalink
fix: Failed to quote if failed to get gauge list (#10809)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->


<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving error handling in the
`safeGetGaugesByChain` function by ensuring that the `getGaugesByChain`
call is awaited, which helps in properly managing asynchronous
operations.

### Detailed summary
- Updated the `safeGetGaugesByChain` function to use `await` with
`getGaugesByChain(chainId)`, ensuring the promise resolves before
proceeding.
- Enhanced error handling by maintaining the existing `try-catch`
structure to log errors and return an empty array on failure.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
chefjackson authored Oct 11, 2024
1 parent 2a0ef2f commit bab8589
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/heavy-wolves-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pancakeswap/gauges': patch
---

Fix unable to get pair combination when failed to get gauge list
2 changes: 1 addition & 1 deletion packages/gauges/src/getGaugesByChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const getGaugesByChain = createGaugesByChainFetcher()

export async function safeGetGaugesByChain(chainId?: ChainId) {
try {
return getGaugesByChain(chainId)
return await getGaugesByChain(chainId)
} catch (e) {
console.error(e)
return []
Expand Down

0 comments on commit bab8589

Please sign in to comment.