mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Update switchEthereumChain unrecognized chain error (#11030)
This commit is contained in:
parent
4ced29e3a2
commit
434249f171
@ -63,7 +63,7 @@ async function switchEthereumChainHandler(
|
|||||||
|
|
||||||
const existingNetwork = findCustomRpcBy({ chainId: _chainId });
|
const existingNetwork = findCustomRpcBy({ chainId: _chainId });
|
||||||
|
|
||||||
if (existingNetwork !== null) {
|
if (existingNetwork) {
|
||||||
const currentChainId = getCurrentChainId();
|
const currentChainId = getCurrentChainId();
|
||||||
if (currentChainId === _chainId) {
|
if (currentChainId === _chainId) {
|
||||||
res.result = null;
|
res.result = null;
|
||||||
@ -88,5 +88,10 @@ async function switchEthereumChainHandler(
|
|||||||
}
|
}
|
||||||
return end();
|
return end();
|
||||||
}
|
}
|
||||||
return end(ethErrors.provider.userRejectedRequest());
|
return end(
|
||||||
|
ethErrors.provider.custom({
|
||||||
|
code: 4902, // To-be-standardized "unrecognized chain ID" error
|
||||||
|
message: `Unrecognized chain ID "${chainId}". Try adding the chain using ${MESSAGE_TYPE.ADD_ETHEREUM_CHAIN} first.`,
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user