Skip to content

Node.js based forum software built for the modern web

Fix unhandled callback errors

Mathias Schreckfef9ec7ad65b
diff --git a/public/src/admin/settings/email.js b/public/src/admin/settings/email.js
index 02edfffcaa..e404099800 100644
--- a/public/src/admin/settings/email.js
+++ b/public/src/admin/settings/email.js
@@ -79,6 +79,10 @@ define('admin/settings/email', ['admin/settings'], function(settings) {
}
socket.emit('meta.getServerTime', {}, function(err, now) {
+ if (err) {
+ return app.alertError(err.message);
+ }
+
now = new Date(now);
$('#serverTime').text(now.toString());
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index e0dc2f5649..ce2c652b6a 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -381,7 +381,9 @@ authenticationController.localLogin = function(req, username, password, next) {
if (result.banned) {
// Retrieve ban reason and show error
return user.getLatestBanInfo(uid, function(err, banInfo) {
- if (banInfo.reason) {
+ if (err) {
+ next(err);
+ } else if (banInfo.reason) {
next(new Error('[[error:user-banned-reason, ' + banInfo.reason + ']]'));
} else {
next(new Error('[[error:user-banned]]'));