[local-sync] Account for additional IMAP retryable errors

Summary:
There are 2 types of IMAP errors that need to be treated as retryable. See code
comments as to why.

Test Plan: manual

Reviewers: khamidou, evan, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D3811
This commit is contained in:
Juan Tejada 2017-01-30 23:36:11 -08:00
parent 6aa5ad509a
commit 71959b44fb
2 changed files with 16 additions and 0 deletions

View file

@ -76,6 +76,21 @@ class IMAPCertificateError extends NylasError { }
*/
function convertImapError(imapError) {
let error;
if (imapError.message.includes('System Error')) {
// System Errors encountered in the wild so far have been retryable.
error = new RetryableError(imapError)
error.source = imapError.source
return error
}
if (imapError.message.includes('User is authenticated but not connected')) {
// We need to treat this type of error as retryable
// See https://github.com/mscdex/node-imap/issues/523 for more details
error = new IMAPSocketError(imapError)
error.source = imapError.source
return error
}
switch (imapError.source) {
case "socket-timeout":
error = new IMAPConnectionTimeoutError(imapError); break;

View file

@ -5,6 +5,7 @@ const {Actions} = require('nylas-exports')
const SyncWorker = require('./sync-worker');
const LocalDatabaseConnector = require('../shared/local-database-connector')
class SyncProcessManager {
constructor() {
this._workers = {};