From 05fd276ec76f2cadf93156c1b0c41b15692aa888 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Wed, 18 Jan 2017 13:36:50 -0800 Subject: [PATCH] [cloud-api] Improve auth error logging --- packages/isomorphic-core/src/auth-helpers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/isomorphic-core/src/auth-helpers.js b/packages/isomorphic-core/src/auth-helpers.js index 2a990d052..a3eca555d 100644 --- a/packages/isomorphic-core/src/auth-helpers.js +++ b/packages/isomorphic-core/src/auth-helpers.js @@ -140,13 +140,15 @@ module.exports = { return reply(JSON.stringify(response)); }) .catch((err) => { - request.logger.error(err) if (err instanceof IMAPErrors.IMAPAuthenticationError) { + global.Logger.error({err}, 'Encountered authentication error while attempting to authenticate') return reply({message: USER_ERRORS.IMAP_AUTH, type: "api_error"}).code(401); } if (err instanceof IMAPErrors.RetryableError) { + global.Logger.error({err}, 'Encountered retryable error while attempting to authenticate') return reply({message: USER_ERRORS.IMAP_RETRY, type: "api_error"}).code(408); } + global.Logger.error({err}, 'Encountered unknown error while attempting to authenticate') return reply({message: USER_ERRORS.AUTH_500, type: "api_error"}).code(500); }) }