From bab85897a25eceb4280975133477623e3726e1ca Mon Sep 17 00:00:00 2001 From: chefjackson <116779127+chefjackson@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:01:39 +0800 Subject: [PATCH] fix: Failed to quote if failed to get gauge list (#10809) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## 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}` --- .changeset/heavy-wolves-yawn.md | 5 +++++ packages/gauges/src/getGaugesByChain.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/heavy-wolves-yawn.md diff --git a/.changeset/heavy-wolves-yawn.md b/.changeset/heavy-wolves-yawn.md new file mode 100644 index 0000000000000..b46d5fcf3e243 --- /dev/null +++ b/.changeset/heavy-wolves-yawn.md @@ -0,0 +1,5 @@ +--- +'@pancakeswap/gauges': patch +--- + +Fix unable to get pair combination when failed to get gauge list diff --git a/packages/gauges/src/getGaugesByChain.ts b/packages/gauges/src/getGaugesByChain.ts index 7f95e3eb39dcc..339839047dda0 100644 --- a/packages/gauges/src/getGaugesByChain.ts +++ b/packages/gauges/src/getGaugesByChain.ts @@ -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 []