{
  "type": "module",
  "source": "doc/api/api-mockerrors.md",
  "modules": [
    {
      "textRaw": "MockErrors",
      "name": "mockerrors",
      "introduced_in": "v4.0.0",
      "type": "module",
      "stability": 2,
      "stabilityText": "Stable",
      "desc": "<p>undici raises a dedicated error when a mocked request cannot be matched against\nany registered interceptor. The mock error classes are exposed through the\n<code>mockErrors</code> namespace of the package:</p>\n<pre><code class=\"language-js\">import { mockErrors } from 'undici'\n\nif (err instanceof mockErrors.MockNotMatchedError) {\n  // handle an unmatched mocked request\n}\n</code></pre>\n<p>Like every other undici error, the classes in this namespace extend\n<a href=\"Errors.html#class-undicierror\"><code>UndiciError</code></a> and carry a stable <code>code</code> string, so failures can be\ndistinguished programmatically without relying on the error message.</p>",
      "classes": [
        {
          "textRaw": "Class: `MockNotMatchedError`",
          "name": "MockNotMatchedError",
          "type": "class",
          "meta": {
            "added": [
              "v4.0.0"
            ],
            "changes": []
          },
          "desc": "<ul>\n<li>Extends: <a href=\"Errors.md#class-undicierror\"><code>&#x3C;UndiciError></code></a></li>\n</ul>\n<p>Thrown when a request issued against a <a href=\"MockAgent.html#class-mockagent\"><code>MockAgent</code></a> does not match any of the\nregistered mock dispatches and the agent is configured to disable net connect.</p>\n<ul>\n<li><code>name</code> <a href=\"https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type\"><code>&#x3C;string></code></a> Always <code>'MockNotMatchedError'</code>.</li>\n<li><code>code</code> <a href=\"https://developer.mozilla.org/docs/Web/JavaScript/Data_structures#string_type\"><code>&#x3C;string></code></a> Always <code>'UND_MOCK_ERR_MOCK_NOT_MATCHED'</code>.</li>\n</ul>",
          "signatures": [
            {
              "textRaw": "`new MockNotMatchedError([message])`",
              "name": "MockNotMatchedError",
              "type": "ctor",
              "meta": {
                "added": [
                  "v4.0.0"
                ],
                "changes": []
              },
              "params": [
                {
                  "textRaw": "`message` {string} The error message. **Default:** `'The request does not match any registered mock dispatches'`.",
                  "name": "message",
                  "type": "string",
                  "default": "`'The request does not match any registered mock dispatches'`",
                  "desc": "The error message.",
                  "optional": true
                }
              ],
              "desc": "<p>Creates a new <code>MockNotMatchedError</code>. When <code>message</code> is omitted, a default\nmessage describing the unmatched request is used.</p>\n<pre><code class=\"language-js\">import { mockErrors } from 'undici'\n\ntry {\n  // ... perform a request that no mock matches ...\n} catch (err) {\n  if (err.code === 'UND_MOCK_ERR_MOCK_NOT_MATCHED') {\n    console.error('No registered mock matched the request')\n  }\n}\n</code></pre>"
            }
          ]
        }
      ]
    }
  ]
}