Skip to content

Commit

Permalink
fix: avoid crashed on econnresets
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlaud committed Feb 28, 2024
1 parent 680d043 commit 81748ca
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 81748ca

Please sign in to comment.