Skip to content

Commit

Permalink
Merge pull request #721 from snyk/fix/avoid-crashing-on-econnresets
Browse files Browse the repository at this point in the history
fix: avoid crashed on econnresets
  • Loading branch information
aarlaud authored Feb 28, 2024
2 parents 680d043 + 81748ca commit eaec38c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/common/http/downstream-post-stream-to-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BrokerServerPostResponseHandler {
},
'received error sending data via POST to Broker Server',
);
this.#buffer.end(e);
this.#buffer.end(e.message);
})
.on('response', (r) => {
r.on('error', (err) => {
Expand Down Expand Up @@ -171,7 +171,7 @@ class BrokerServerPostResponseHandler {
// If we *don't* have a buffer object, then there was a major failure with the request (e.g., host not found), so
// we will forward that directly to the Broker Server
if (this.#buffer) {
this.#buffer.end(error);
this.#buffer.end(error.message);
} else {
const body = JSON.stringify({ error: error });
this.#sendIoData(
Expand Down

0 comments on commit eaec38c

Please sign in to comment.