From ded002924a9c482f355c95709cd7f945e7c26ec0 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Thu, 26 Jan 2017 11:50:52 -0800 Subject: [PATCH] [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 --- packages/isomorphic-core/src/imap-box.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/isomorphic-core/src/imap-box.js b/packages/isomorphic-core/src/imap-box.js index 1aacf3b83..a03069ba5 100644 --- a/packages/isomorphic-core/src/imap-box.js +++ b/packages/isomorphic-core/src/imap-box.js @@ -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}).`); } } }