From 8be3f71eed4ab2dbdbc6a9d3f138679bf61dd54c Mon Sep 17 00:00:00 2001 From: valentine Date: Mon, 1 Jul 2024 13:25:18 +0300 Subject: [PATCH] remove unnecessary try/catch --- .../components/default-frontend-form/index.tsx | 17 ++++++----------- .../use-grpc-endpoint-form.ts | 11 +++-------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/apps/extension/src/shared/components/default-frontend-form/index.tsx b/apps/extension/src/shared/components/default-frontend-form/index.tsx index 6d509481..596d8dfd 100644 --- a/apps/extension/src/shared/components/default-frontend-form/index.tsx +++ b/apps/extension/src/shared/components/default-frontend-form/index.tsx @@ -14,17 +14,12 @@ interface DisplayedFrontend { } const getFrontendsFromRegistry = (selectedRpc?: string): DisplayedFrontend[] => { - let registeredFrontends: DisplayedFrontend[] = []; - try { - const registryClient = new ChainRegistryClient(); - const { frontends } = registryClient.globals(); - registeredFrontends = frontends.map(frontend => ({ - title: extractDomain(frontend), - url: frontend, - })); - } catch (e) { - console.error('Registry globals is not available', e); - } + const registryClient = new ChainRegistryClient(); + const { frontends } = registryClient.globals(); + const registeredFrontends = frontends.map(frontend => ({ + title: extractDomain(frontend), + url: frontend, + })); if (selectedRpc) { registeredFrontends.push({ title: 'Embedded RPC frontend', url: `${selectedRpc}/app/` }); diff --git a/apps/extension/src/shared/components/grpc-endpoint-form/use-grpc-endpoint-form.ts b/apps/extension/src/shared/components/grpc-endpoint-form/use-grpc-endpoint-form.ts index 8b07045d..78ea65b9 100644 --- a/apps/extension/src/shared/components/grpc-endpoint-form/use-grpc-endpoint-form.ts +++ b/apps/extension/src/shared/components/grpc-endpoint-form/use-grpc-endpoint-form.ts @@ -18,14 +18,9 @@ const useSaveGrpcEndpointSelector = (state: AllSlices) => ({ }); const getRpcsFromRegistry = () => { - try { - const registryClient = new ChainRegistryClient(); - const { rpcs } = registryClient.globals(); - return rpcs.toSorted(randomSort); - } catch (e) { - console.error('Registry globals is not available', e); - return []; - } + const registryClient = new ChainRegistryClient(); + const { rpcs } = registryClient.globals(); + return rpcs.toSorted(randomSort); }; export const useGrpcEndpointForm = (isOnboarding: boolean) => {