Closed itaied246 closed 2 years ago
You can actually use Express' error handler to catch the error:
app.use((err, req, res, next) => {
console.error(err)
res.writeHead(500, {
"Content-Type": "text/plain",
});
res.end("Internal server error.");
});
Checks
http-proxy-middleware
.Describe the bug (be clear and concise)
I have set the proxy with custom router logic:
When an error inside the router logic happens, the
onError
doesn't receive it and the client receive the error.Step-by-step reproduction instructions
Expected behavior (be clear and concise)
The error handler should receive and handle the errors happening in the router
How is http-proxy-middleware used in your project?
What OS/version and node/version are you seeing the problem?