better error messaging when js fails to compile when reloading

v1.18.x
Julian Lam 11 years ago
parent e497290dbc
commit 2d9ca83ae0

@ -75,5 +75,7 @@
"cant-chat-with-yourself": "You can't chat with yourself!", "cant-chat-with-yourself": "You can't chat with yourself!",
"not-enough-reputation-to-downvote": "You do not have enough reputation to downvote this post" "not-enough-reputation-to-downvote": "You do not have enough reputation to downvote this post",
"reload-failed": "NodeBB encountered a problem while reloading: \"%1\". NodeBB will continue to serve the existing client-side assets, although you should undo what you did just prior to reloading."
} }

@ -85,7 +85,7 @@ define('forum/admin/index', function() {
alert_id: 'instance_reload', alert_id: 'instance_reload',
type: 'danger', type: 'danger',
title: '[[global:alert.error]]', title: '[[global:alert.error]]',
message: err.message message: '[[error:reload-failed, ' + err.message + ']]'
}); });
} }
}); });

@ -38,11 +38,9 @@ var async = require('async'),
], function(err) { ], function(err) {
if (!err) { if (!err) {
emitter.emit('nodebb:ready'); emitter.emit('nodebb:ready');
callback.apply(null, arguments);
} else {
console.log('failed!');
emitter.emit('nodebb:reload.failed');
} }
callback.apply(null, arguments);
}); });
}); });
}; };

@ -166,7 +166,7 @@ module.exports = function(Meta) {
winston.error('[meta/js] Could not compile client-side scripts! ' + message.payload.message); winston.error('[meta/js] Could not compile client-side scripts! ' + message.payload.message);
minifier.kill(); minifier.kill();
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(err); callback(new Error(message.payload.message));
} else { } else {
process.exit(0); process.exit(0);
} }

Loading…
Cancel
Save