mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
Only recognize "blocked" status for built-in networks (#19069)
The detection of the Infura "blocked" status has been updated to apply only to built-in networks. The message we show to users in this state is meant only for Infura; we don't want to show it for third-party RPC APIs that happen to use the same error response. This brings the network controller further in alignment with the core network controller. This isn't tested, but it was found in the course of porting unit tests from core to extension. It will be covered by these tests, which will be added in the next PR.
This commit is contained in:
parent
46c2f1cc56
commit
cf7c790505
@ -623,13 +623,15 @@ export class NetworkController extends EventEmitter {
|
|||||||
supportsEIP1559 = results[1];
|
supportsEIP1559 = results[1];
|
||||||
networkStatus = NetworkStatus.Available;
|
networkStatus = NetworkStatus.Available;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isErrorWithCode(error) && isErrorWithMessage(error)) {
|
if (isErrorWithCode(error)) {
|
||||||
let responseBody;
|
let responseBody;
|
||||||
|
if (isInfura && isErrorWithMessage(error)) {
|
||||||
try {
|
try {
|
||||||
responseBody = JSON.parse(error.message);
|
responseBody = JSON.parse(error.message);
|
||||||
} catch {
|
} catch {
|
||||||
// error.message must not be JSON
|
// error.message must not be JSON
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isPlainObject(responseBody) &&
|
isPlainObject(responseBody) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user