function handleProxyError()

in cloudrun-malware-scanner/gcs-proxy-server.ts [69:83]


function handleProxyError(
  err: Error,
  req: IncomingMessage,
  res: ServerResponse | Socket,
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  _target?: httpProxy.ProxyTargetUrl,
): void {
  logger.error(
    `Failed to proxy to GCS for path ${req.url}, returning code 500: ${err}`,
  );
  (res as ServerResponse).writeHead(500, {
    'Content-Type': 'text/plain',
  });
  res.end(`Failed to proxy to GCS: internal error\n`);
}