From e7ee73dcf7aa781256129360375fa31216f43471 Mon Sep 17 00:00:00 2001 From: Steven Luscher Date: Wed, 18 Oct 2023 14:07:36 -0700 Subject: [PATCH] Catch errors when building token options in search (#307) Closes #300. --- 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)) ?? [] : [];