Skip to content

Commit 83b5ebc

Browse files
committed
Let Code handle errors
This way we will not have to patch Code to make this work and I think it makes sense to let Code handle the request. If we do want to handle errors we can do it cleanly by patching their error handler to throw instead.
1 parent 7b6fc21 commit 83b5ebc

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

src/node/routes/vscode.ts

-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { authenticated, ensureAuthenticated, redirect, self } from "../http"
1111
import { SocketProxyProvider } from "../socket"
1212
import { isFile, loadAMDModule } from "../util"
1313
import { Router as WsRouter } from "../wsRouter"
14-
import { errorHandler } from "./errors"
1514

1615
export interface IServerAPI {
1716
handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise<void>
@@ -92,17 +91,6 @@ export class CodeServerRouteWrapper {
9291
}
9392

9493
private $proxyRequest: express.Handler = async (req, res, next) => {
95-
// We allow certain errors to propagate so that other routers may handle requests
96-
// outside VS Code
97-
const requestErrorHandler = (error: any) => {
98-
if (error instanceof Error && ["EntryNotFound", "FileNotFound", "HttpError"].includes(error.message)) {
99-
next()
100-
}
101-
errorHandler(error, req, res, next)
102-
}
103-
104-
req.once("error", requestErrorHandler)
105-
10694
this._codeServerMain.handleRequest(req, res)
10795
}
10896

0 commit comments

Comments
 (0)