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.
This commit is contained in:
Felix Rieseberg 2014-08-10 18:52:40 -07:00
parent 2b1beee7da
commit 4cd78e3e4d

View File

@ -50,9 +50,13 @@ var DebugController = Ember.Controller.extend(Ember.Evented, {
ic.ajax.request(this.get('ghostPaths.url').api('mail', 'test'), { ic.ajax.request(this.get('ghostPaths.url').api('mail', 'test'), {
type: 'POST' type: 'POST'
}).then(function () { }).then(function () {
self.notifications.showSuccess('Check your email for the test message:'); self.notifications.showSuccess('Check your email for the test message.');
}).catch(function (response) { }).catch(function (error) {
self.notifications.showErrors(response); if (typeof error.jqXHR !== 'undefined') {
self.notifications.showAPIError(error);
} else {
self.notifications.showErrors(error);
}
}); });
} }
} }