Skip to content

Commit

Permalink
remove unnecessary try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentine1898 committed Jul 1, 2024
1 parent f4b4b3f commit 8be3f71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/` });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 8be3f71

Please sign in to comment.