diff --git a/lib/imap.js b/lib/imap.js index ac5a18c..de10c3c 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -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); };