From f75a0662d5c6ea2f490f6857421a778231f424fa Mon Sep 17 00:00:00 2001 From: steveluscher Date: Wed, 18 Oct 2023 04:04:46 +0000 Subject: [PATCH] Catch errors when building token options in search --- app/components/SearchBar.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/SearchBar.tsx b/app/components/SearchBar.tsx index 9ef7fe46..173027ea 100644 --- a/app/components/SearchBar.tsx +++ b/app/components/SearchBar.tsx @@ -48,7 +48,12 @@ export function SearchBar() { async function performSearch(search: string): Promise { const localOptions = buildOptions(search, cluster, clusterInfo?.epochInfo.epoch); - const tokenOptions = await buildTokenOptions(search, cluster); + let tokenOptions; + try { + tokenOptions = await buildTokenOptions(search, cluster); + } catch (e) { + console.error(`Failed to build token options for search: ${e instanceof Error ? e.message : e}`); + } const tokenOptionsAppendable = tokenOptions ? [tokenOptions] : []; const domainOptions = hasDomainSyntax(search) && cluster === Cluster.MainnetBeta ? (await buildDomainOptions(search)) ?? [] : [];