Skip to content

Commit 7532a93

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 ebe0c42 commit 7532a93

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>
@@ -115,17 +114,6 @@ export class CodeServerRouteWrapper {
115114
}
116115

117116
private $proxyRequest: express.Handler = async (req, res, next) => {
118-
// We allow certain errors to propagate so that other routers may handle requests
119-
// outside VS Code
120-
const requestErrorHandler = (error: any) => {
121-
if (error instanceof Error && ["EntryNotFound", "FileNotFound", "HttpError"].includes(error.message)) {
122-
next()
123-
}
124-
errorHandler(error, req, res, next)
125-
}
126-
127-
req.once("error", requestErrorHandler)
128-
129117
this._codeServerMain.handleRequest(req, res)
130118
}
131119

0 commit comments

Comments
 (0)