From 3ff98f45a9b8a94f37fccef749002d67ffdbb4f0 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Tue, 22 Nov 2016 18:24:46 -0800 Subject: [PATCH] Rename generic Errors to IMAPErrors --- packages/local-sync/src/local-api/routes/auth.js | 4 ++-- packages/local-sync/src/local-sync-worker/sync-worker.js | 4 ++-- packages/nylas-core/imap-errors.js | 8 ++++---- packages/nylas-core/index.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/local-sync/src/local-api/routes/auth.js b/packages/local-sync/src/local-api/routes/auth.js index 3b648e938..0a7cb6285 100644 --- a/packages/local-sync/src/local-api/routes/auth.js +++ b/packages/local-sync/src/local-api/routes/auth.js @@ -7,7 +7,7 @@ const Serialization = require('../serialization'); const { IMAPConnection, Provider, - Errors, + IMAPErrors, } = require('nylas-core'); const DefaultSyncPolicy = require('../default-sync-policy') const LocalDatabaseConnector = require('../../shared/local-database-connector') @@ -171,7 +171,7 @@ module.exports = (server) => { reply(Serialization.jsonStringify(response)); }) .catch((err) => { - const code = err instanceof Errors.IMAPAuthenticationError ? 401 : 400 + const code = err instanceof IMAPErrors.IMAPAuthenticationError ? 401 : 400 reply({message: err.message, type: "api_error"}).code(code); }) }, diff --git a/packages/local-sync/src/local-sync-worker/sync-worker.js b/packages/local-sync/src/local-sync-worker/sync-worker.js index c6dbadb77..8ff8b56e2 100644 --- a/packages/local-sync/src/local-sync-worker/sync-worker.js +++ b/packages/local-sync/src/local-sync-worker/sync-worker.js @@ -1,7 +1,7 @@ const { IMAPConnection, MessageTypes, - Errors, + IMAPErrors, PromiseUtils, } = require('nylas-core'); const LocalDatabaseConnector = require('../shared/local-database-connector') @@ -211,7 +211,7 @@ class SyncWorker { }) // Continue to retry if it was a network error - if (error instanceof Errors.RetryableError) { + if (error instanceof IMAPErrors.RetryableError) { return Promise.resolve() } diff --git a/packages/nylas-core/imap-errors.js b/packages/nylas-core/imap-errors.js index cd9fe9258..543ab611c 100644 --- a/packages/nylas-core/imap-errors.js +++ b/packages/nylas-core/imap-errors.js @@ -1,5 +1,5 @@ /** - * Errors may come from: + * IMAPErrors may come from: * * 1. Underlying IMAP provider (Fastmail, Yahoo, etc) * 2. Node IMAP @@ -60,13 +60,13 @@ function convertImapError(imapError) { } /** - * An abstract base class that can be used to indicate errors that may fix - * themselves when retried + * An abstract base class that can be used to indicate IMAPErrors that may + * fix themselves when retried */ class RetryableError extends Error { } /** - * Errors that originate from NodeIMAP. See `convertImapError` for + * IMAPErrors that originate from NodeIMAP. See `convertImapError` for * documentation on underlying causes */ class IMAPSocketError extends RetryableError { } diff --git a/packages/nylas-core/index.js b/packages/nylas-core/index.js index 2d6a6dd03..9971c797f 100644 --- a/packages/nylas-core/index.js +++ b/packages/nylas-core/index.js @@ -7,6 +7,6 @@ module.exports = { IMAPConnection: require('./imap-connection'), MessageTypes: require('./message-types'), Logger: require('./logger'), - Errors: require('./imap-errors'), + IMAPErrors: require('./imap-errors'), PromiseUtils: require('./promise-utils'), }