mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
[client-app] Handle errors when opening imap box correctly
Summary: If an error is thrown while opening an imap box, we need to make sure to set the `_isOpening` back to false Test Plan: manual Reviewers: mark Reviewed By: mark Differential Revision: https://phab.nylas.com/D4134
This commit is contained in:
parent
bec943e1e3
commit
ef4778d12a
|
@ -289,13 +289,17 @@ class IMAPConnection extends EventEmitter {
|
|||
return Promise.resolve(new IMAPBox(this, this._imap._box));
|
||||
}
|
||||
return this._withPreparedConnection(async (imap) => {
|
||||
this._isOpeningBox = true
|
||||
this._lastOpenDuration = null;
|
||||
const before = Date.now();
|
||||
const box = await imap.openBoxAsync(folderName, readOnly)
|
||||
this._lastOpenDuration = Date.now() - before;
|
||||
this._isOpeningBox = false
|
||||
return new IMAPBox(this, box)
|
||||
try {
|
||||
this._isOpeningBox = true
|
||||
this._lastOpenDuration = null;
|
||||
const before = Date.now();
|
||||
const box = await imap.openBoxAsync(folderName, readOnly)
|
||||
this._lastOpenDuration = Date.now() - before;
|
||||
this._isOpeningBox = false
|
||||
return new IMAPBox(this, box)
|
||||
} finally {
|
||||
this._isOpeningBox = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue