Open
Conversation
Fixes:
node:events:353
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:213:20)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:188:8)
at emitErrorCloseNT (node:internal/streams/destroy:153:3)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -54,
code: 'ECONNRESET',
syscall: 'read'
}
npm ERR! code 1
There was a problem hiding this comment.
Pull Request Overview
This PR addresses unhandled error events that were causing the application to crash with ECONNRESET errors by adding an empty error handler to the response object.
- Adds an error event listener to suppress connection reset errors
- Prevents application crashes from unhandled socket errors
| } | ||
| r.push(''); | ||
| r.push(''); | ||
| res.on('error', () => {}); |
There was a problem hiding this comment.
Silently suppressing all errors with an empty handler is risky and makes debugging difficult. Consider logging the error or handling specific error types appropriately.
Suggested change
| res.on('error', () => {}); | |
| res.on('error', (err) => { | |
| console.error('Error in fake_response res:', err); | |
| }); |
| } | ||
| r.push(''); | ||
| r.push(''); | ||
| res.on('error', () => {}); |
There was a problem hiding this comment.
The empty error handler provides no context about what errors are being suppressed. At minimum, consider adding a comment explaining why errors are being ignored or log them for debugging purposes.
Suggested change
| res.on('error', () => {}); | |
| res.on('error', (err) => { | |
| // Log the error for debugging purposes | |
| console.error('Error in fake_response:', err); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: