function sendError(status, options) {
      const escapeHtml = require("./utils/escapeHtml");

      const content = statuses[status] || String(status);
      let document = Buffer.from(
        `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>${escapeHtml(content)}</pre>
</body>
</html>`,
        "utf8",
      );

      // Clear existing headers
      const headers = getResponseHeaders(res);

      for (let i = 0; i < headers.length; i++) {
        removeResponseHeader(res, headers[i]);
      }

      if (options && options.headers) {
        const keys = Object.keys(options.headers);

        for (let i = 0; i < keys.length; i++) {
          const key = keys[i];
          const value = options.headers[key];

          if (typeof value !== "undefined") {
            setResponseHeader(res, key, value);
          }
        }
      }

      // Send basic response
      setStatusCode(res, status);
      setResponseHeader(res, "Content-Type", "text/html; charset=utf-8");
      setResponseHeader(res, "Content-Security-Policy", "default-src 'none'");
      setResponseHeader(res, "X-Content-Type-Options", "nosniff");

      let byteLength = Buffer.byteLength(document);

      if (options && options.modifyResponseData) {
        ({ data: document, byteLength } =
          /** @type {{ data: Buffer<ArrayBuffer>, byteLength: number }} */
          (options.modifyResponseData(req, res, document, byteLength)));
      }

      setResponseHeader(res, "Content-Length", byteLength);

      finish(res, document);
    }
@param {number} status status
@param {Partial<SendErrorOptions<Request, Response>>=} options options
@returns {void}