From b72cf78067a30fd13ca64e6685b9701ff80e5fb5 Mon Sep 17 00:00:00 2001 From: Kai Tamkun Date: Wed, 14 May 2025 14:37:26 -0700 Subject: [PATCH] Match Node's weird error message --- src/js/node/vm.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/node/vm.ts b/src/js/node/vm.ts index 33decc7e8b..02d30c127c 100644 --- a/src/js/node/vm.ts +++ b/src/js/node/vm.ts @@ -67,7 +67,10 @@ function measureMemory() { function validateContext(contextifiedObject) { if (!isContext(contextifiedObject)) { - throw $ERR_INVALID_ARG_TYPE("contextifiedObject", "vm.Context", contextifiedObject); + const error = new Error('The "contextifiedObject" argument must be an vm.Context'); + error.code = "ERR_INVALID_ARG_TYPE"; + error.name = "TypeError"; + throw error; } }