function done()

in src/https.ts [119:139]


    function done(...args: [Error] | [null, ResultType]) {
      if (responseTimeout) clearTimeout(responseTimeout);
      if (args[0] == null) {
        resolve(args[1]);
        return;
      }

      // In case of errors, let the Agent (if any) know to abandon the socket
      // This is probably best, because the socket may have become stale
      /* istanbul ignore next */
      req.socket?.emit("agentRemove");

      // Turn error into FetchError so the URI is nicely captured in the message
      let error = args[0];
      if (!(error instanceof FetchError)) {
        error = new FetchError(uri, error.message);
      }

      req.destroy();
      reject(error);
    }