mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-09-29 16:34:37 +08:00
Suppress ETIMEDOUT errors
This commit is contained in:
parent
a0b053ddaa
commit
1fb58cf45f
2 changed files with 21 additions and 2 deletions
|
@ -176,7 +176,7 @@ class IMAPServer extends EventEmitter {
|
|||
* @event
|
||||
*/
|
||||
_onError(err) {
|
||||
errors.notify(err);
|
||||
errors.notifyConnection(false, err);
|
||||
this.emit('error', err);
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,21 @@ class IMAPServer extends EventEmitter {
|
|||
return;
|
||||
}
|
||||
returned = true;
|
||||
callback(err || new Error('Socket closed unexpectedly'));
|
||||
if (err && /SSL23_GET_CLIENT_HELLO/.test(err.message)) {
|
||||
let message = err.message;
|
||||
err.message = 'Failed to establish TLS session';
|
||||
err.meta = {
|
||||
message,
|
||||
remoteAddress: socket.remoteAddress
|
||||
};
|
||||
}
|
||||
if (!err) {
|
||||
err = new Error('Socket closed unexpectedly');
|
||||
err.meta = {
|
||||
remoteAddress: socket.remoteAddress
|
||||
};
|
||||
}
|
||||
callback(err);
|
||||
};
|
||||
|
||||
// remove all listeners from the original socket besides the error handler
|
||||
|
|
|
@ -18,6 +18,7 @@ module.exports.notify = (...args) => {
|
|||
};
|
||||
|
||||
module.exports.notifyConnection = (connection, ...args) => {
|
||||
let err = args[0];
|
||||
let metaData = args[1] || {};
|
||||
|
||||
if (connection) {
|
||||
|
@ -33,6 +34,10 @@ module.exports.notifyConnection = (connection, ...args) => {
|
|||
metaData.isUTF8Enabled = !!connection.acceptUTF8Enabled;
|
||||
}
|
||||
|
||||
Object.keys(err.meta || {}).forEach(key => {
|
||||
metaData[key] = err.meta[key];
|
||||
});
|
||||
|
||||
args[1] = metaData;
|
||||
|
||||
if (bugsnag) {
|
||||
|
|
Loading…
Add table
Reference in a new issue