[iso-core] Detect more offline errors when sending

Summary:
See title.
I really wish we could clean up this error handling a bit better, but I don't
think its super important right now.

Test Plan: manual

Reviewers: spang, evan, halla

Reviewed By: evan, halla

Differential Revision: https://phab.nylas.com/D3903
This commit is contained in:
Juan Tejada 2017-02-13 11:38:18 -08:00
parent 85dc9f319e
commit dbb404ccba

View file

@ -50,7 +50,11 @@ class SendmailClient {
throw new APIError('Sending failed - Invalid login', 401, {originalError: error})
}
if (error.message.startsWith("getaddrinfo ENOTFOUND")) {
if (error.message.includes("getaddrinfo ENOTFOUND")) {
throw new APIError('Sending failed - Network Error', 401, {originalError: error})
}
if (error.message.includes("connect ETIMEDOUT")) {
throw new APIError('Sending failed - Network Error', 401, {originalError: error})
}