1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-26 12:15:26 +00:00

Catch proxy errors

Otherwise they'll crash code-server.
This commit is contained in:
Asher 2020-03-24 16:34:31 -05:00
parent c0dd29c591
commit 737a8f5965
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -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(