-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caught exception: Error: read ECONNRESET #1564
Comments
have you installed an error handler on the request object? such as: request.on('error', (e) => {
console.log(e)
}) and does it improve the situation any better? |
ping @zdying |
Yes, i have error handler. my code is: proxy.on('error', function (e) {
if (e.code === 'ENOTFOUND') {
res.statusCode = 404;
} else {
res.statusCode = 500;
}
res.end(e.stack);
next();
}); I think if not add |
@zdying - I did not follow your last statement, can you please clarify? |
ping @zdying |
I mean that I Have error handler. I think If no error handler provided, it SHOULD tell me I have an uncaught error, and should NOT tell me it’s a caught error. I don’t know what does the “caught exception” mean |
probably related: nodejs/node#14102 @zdying - without a program to reproduce the issue it is really difficult to pin point the root cause. At high level, the module that issues the request (plain tcp socket / http request api / request module or any other middleware component) should install an error handler, which gets invoked on a low level event such as network read error. In your case, I would recommend:
|
@gireeshpunathil OK, i will try it. thanks. |
hi, i have an Node.js app that will use http.request and https.request. some times it print some log:
but no detail error stack printed. so i don't know where the error has been emitted and which domain request failed.
I want to catch the error myself and get the full error.stack , what can i do?
The text was updated successfully, but these errors were encountered: