Skip to content

Commit

Permalink
wrap new URL in try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
MicaiahReid committed May 10, 2022
1 parent 2be88f4 commit f4cfade
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ async function addEthereumChainHandler(
}

const isLocalhost = (strUrl) => {
const url = new URL(strUrl);
return url.hostname === 'localhost' || url.hostname === '127.0.0.1';
try {
const url = new URL(strUrl);
return url.hostname === 'localhost' || url.hostname === '127.0.0.1';
} catch (error) {
return false;
}
};

const firstValidRPCUrl = Array.isArray(rpcUrls)
Expand Down

0 comments on commit f4cfade

Please sign in to comment.