Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
fix: catch errors before and after stream write
Browse files Browse the repository at this point in the history
  • Loading branch information
vladholubiev committed Feb 18, 2019
1 parent 154544d commit d8f996f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ module.exports = class DatadogTransport extends Transport {
console.log('datadog socket error', error);
})
.write(`${config.apiKey} ${JSON.stringify(logEntry)}\r\n`, () => {
socket.end();
socket.end().on('error', error => {
// eslint-disable-next-line no-console
console.log('datadog socket end error', error);
});

return callback();
});
Expand Down

0 comments on commit d8f996f

Please sign in to comment.