Skip to content

Commit 330e75a

Browse files
committed
Catch proxy errors
Otherwise they'll crash code-server.
1 parent 2a276b4 commit 330e75a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/node/app/proxy.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { logger } from "@coder/logger"
12
import * as http from "http"
23
import proxy from "http-proxy"
34
import * as net from "net"
@@ -21,6 +22,7 @@ export class ProxyHttpProvider extends HttpProvider implements HttpProxyProvider
2122
public constructor(options: HttpProviderOptions, proxyDomains: string[] = []) {
2223
super(options)
2324
this.proxyDomains = proxyDomains.map((d) => d.replace(/^\*\./, "")).filter((d, i, arr) => arr.indexOf(d) === i)
25+
this.proxy.on("error", (error) => logger.warn(error.message))
2426
}
2527

2628
public async handleRequest(

0 commit comments

Comments
 (0)