From 4cd78e3e4d3681c3678f78056370d9fed8c1722d Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Sun, 10 Aug 2014 18:52:40 -0700 Subject: [PATCH] Error notification if send mail api returns 500 closes #3728 - If the mail config is broken, the ajax call will fail with 500 and not return an error. - This change catches 500 and wraps the error in a notification. --- ghost/admin/controllers/debug.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ghost/admin/controllers/debug.js b/ghost/admin/controllers/debug.js index 4fdc18b0db..fdeff2279e 100644 --- a/ghost/admin/controllers/debug.js +++ b/ghost/admin/controllers/debug.js @@ -50,9 +50,13 @@ var DebugController = Ember.Controller.extend(Ember.Evented, { ic.ajax.request(this.get('ghostPaths.url').api('mail', 'test'), { type: 'POST' }).then(function () { - self.notifications.showSuccess('Check your email for the test message:'); - }).catch(function (response) { - self.notifications.showErrors(response); + self.notifications.showSuccess('Check your email for the test message.'); + }).catch(function (error) { + if (typeof error.jqXHR !== 'undefined') { + self.notifications.showAPIError(error); + } else { + self.notifications.showErrors(error); + } }); } }