[iso-core] Fix imap error detection/coercion (again)

Summary:
If for whatever reason we passed an error with a `source` property
we weren't accounting for in `convertIMAPError`, we would return an
`undefined` error. Bad!

Instead, just return the original error

Test Plan: manual

Reviewers: spang, halla, evan, mark

Reviewed By: evan, mark

Differential Revision: https://phab.nylas.com/D4037
This commit is contained in:
Juan Tejada 2017-02-23 01:54:12 -08:00
parent e6b35497b8
commit 93836f7973

View file

@ -75,7 +75,7 @@ class IMAPCertificateError extends NylasError { }
*
*/
function convertImapError(imapError) {
let error;
let error = imapError;
if (imapError.message.toLowerCase().includes('try again')) {
error = new RetryableError(imapError)
@ -115,7 +115,7 @@ function convertImapError(imapError) {
case "timeout-auth":
error = new IMAPAuthenticationTimeoutError(imapError); break;
default:
return error
break;
}
error.source = imapError.source
return error