[local-sync] Make invalid imap box errors retryable

Summary:
If we attempt to operate on a box that is no longer open, we should make
the error retryable so that we re-open the correct box and continue
syncing instead of showing the scary red box to users

Addresses T7680

Test Plan: manual

Reviewers: evan, spang, halla, mark

Reviewed By: halla, mark

Subscribers: mark

Differential Revision: https://phab.nylas.com/D3792
This commit is contained in:
Juan Tejada 2017-01-26 11:50:52 -08:00
parent 1d96c3f4da
commit ded002924a

View file

@ -1,6 +1,7 @@
const _ = require('underscore');
const {
RetryableError,
IMAPConnectionNotReadyError,
} = require('./imap-errors');
@ -23,7 +24,7 @@ class IMAPBox {
const openBox = obj._conn.getOpenBoxName()
if (myBox !== openBox) {
return () => {
throw new Error(`IMAPBox::${prop} - Mailbox is no longer selected on the IMAPConnection (${myBox} != ${openBox}).`);
throw new RetryableError(`IMAPBox::${prop} - Mailbox is no longer selected on the IMAPConnection (${myBox} != ${openBox}).`);
}
}
}