mirror of
https://github.com/cdr/code-server.git
synced 2025-12-07 08:52:16 +01:00
Catch proxy errors
Otherwise they'll crash code-server.
This commit is contained in:
parent
c0dd29c591
commit
737a8f5965
1 changed files with 2 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { logger } from "@coder/logger"
|
||||||
import * as http from "http"
|
import * as http from "http"
|
||||||
import proxy from "http-proxy"
|
import proxy from "http-proxy"
|
||||||
import * as net from "net"
|
import * as net from "net"
|
||||||
|
|
@ -21,6 +22,7 @@ export class ProxyHttpProvider extends HttpProvider implements HttpProxyProvider
|
||||||
public constructor(options: HttpProviderOptions, proxyDomains: string[] = []) {
|
public constructor(options: HttpProviderOptions, proxyDomains: string[] = []) {
|
||||||
super(options)
|
super(options)
|
||||||
this.proxyDomains = proxyDomains.map((d) => d.replace(/^\*\./, "")).filter((d, i, arr) => arr.indexOf(d) === i)
|
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(
|
public async handleRequest(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue