From 737a8f5965b2150f86d120135bef26fb6e3e6f48 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 24 Mar 2020 16:34:31 -0500 Subject: [PATCH] Catch proxy errors Otherwise they'll crash code-server. --- src/node/app/proxy.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node/app/proxy.ts b/src/node/app/proxy.ts index 7b79d96f..8f551244 100644 --- a/src/node/app/proxy.ts +++ b/src/node/app/proxy.ts @@ -1,3 +1,4 @@ +import { logger } from "@coder/logger" import * as http from "http" import proxy from "http-proxy" import * as net from "net" @@ -21,6 +22,7 @@ export class ProxyHttpProvider extends HttpProvider implements HttpProxyProvider public constructor(options: HttpProviderOptions, proxyDomains: string[] = []) { super(options) this.proxyDomains = proxyDomains.map((d) => d.replace(/^\*\./, "")).filter((d, i, arr) => arr.indexOf(d) === i) + this.proxy.on("error", (error) => logger.warn(error.message)) } public async handleRequest(