add more detail to error object

fork
mscdex 12 years ago
parent 86efc68998
commit 28999b3b45

@ -642,6 +642,7 @@ ImapConnection.prototype.connect = function(loginCb) {
if (line[0] === '+') {
if (requests[0].cmd !== 'APPEND') {
err = new Error('Unexpected continuation');
err.level = 'protocol';
err.type = 'continuation';
err.request = cmdstr;
} else
@ -651,6 +652,7 @@ ImapConnection.prototype.connect = function(loginCb) {
// m[2]: resp-text-code
// m[3]: message
err = new Error(m[3]);
err.level = 'protocol';
err.type = 'failure';
err.code = m[2];
err.request = cmdstr;
@ -718,7 +720,9 @@ ImapConnection.prototype.connect = function(loginCb) {
state.tmrConn = setTimeout(function() {
state.conn.destroy();
state.conn = undefined;
loginCb(new Error('Connection timed out'));
var err = new Error('Connection timed out');
err.level = 'timeout';
loginCb(err);
}, this._options.connTimeout);
};

Loading…
Cancel
Save