diff --git a/app/scripts/controllers/network/network-controller.ts b/app/scripts/controllers/network/network-controller.ts index 463565a54..b6fd4a503 100644 --- a/app/scripts/controllers/network/network-controller.ts +++ b/app/scripts/controllers/network/network-controller.ts @@ -307,10 +307,9 @@ function isErrorWithCode(error: unknown): error is { code: string | number } { * @param value - The value to check. */ function assertNetworkId(value: any): asserts value is NetworkId { - assert( - /^\d+$/u.test(value) && !Number.isNaN(Number(value)), - 'value is not a number', - ); + if (!/^\d+$/u.test(value) || Number.isNaN(Number(value))) { + throw new Error('value is not a number'); + } } /**