From 41a4a7cce4591340893c9ecc9c7c7bf6a26c4b54 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Tue, 26 Aug 2025 21:30:13 +0200 Subject: [PATCH] fix: avoid instanceof MockNotMatchedError --- lib/mock/mock-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mock/mock-utils.js b/lib/mock/mock-utils.js index 822d45d153f..8f72ef07414 100644 --- a/lib/mock/mock-utils.js +++ b/lib/mock/mock-utils.js @@ -367,7 +367,7 @@ function buildMockDispatch () { try { mockDispatch.call(this, opts, handler) } catch (error) { - if (error instanceof MockNotMatchedError) { + if (error.code === 'UND_MOCK_ERR_MOCK_NOT_MATCHED') { const netConnect = agent[kGetNetConnect]() if (netConnect === false) { throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`)