Skip to content

Node.js based forum software built for the modern web

better error messaging when js fails to compile when reloading

Julian Lam2d9ca83ae024
diff --git a/public/language/en_GB/error.json b/public/language/en_GB/error.json
index 2b9a0aec46..75d43fce3f 100644
--- a/public/language/en_GB/error.json
+++ b/public/language/en_GB/error.json
@@ -75,5 +75,7 @@
"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."
}
\ No newline at end of file
diff --git a/public/src/forum/admin/index.js b/public/src/forum/admin/index.js
index 031cfb0049..e45c661628 100644
--- a/public/src/forum/admin/index.js
+++ b/public/src/forum/admin/index.js
@@ -85,7 +85,7 @@ define('forum/admin/index', function() {
alert_id: 'instance_reload',
type: 'danger',
title: '[[global:alert.error]]',
- message: err.message
+ message: '[[error:reload-failed, ' + err.message + ']]'
});
}
});
diff --git a/src/meta.js b/src/meta.js
index 137a4b238f..8ac432e4ad 100644
--- a/src/meta.js
+++ b/src/meta.js
@@ -38,11 +38,9 @@ var async = require('async'),
], function(err) {
if (!err) {
emitter.emit('nodebb:ready');
- callback.apply(null, arguments);
- } else {
- console.log('failed!');
- emitter.emit('nodebb:reload.failed');
}
+
+ callback.apply(null, arguments);
});
});
};
diff --git a/src/meta/js.js b/src/meta/js.js
index 14e3112f19..e4d361c74f 100644
--- a/src/meta/js.js
+++ b/src/meta/js.js
@@ -166,7 +166,7 @@ module.exports = function(Meta) {
winston.error('[meta/js] Could not compile client-side scripts! ' + message.payload.message);
minifier.kill();
if (typeof callback === 'function') {
- callback(err);
+ callback(new Error(message.payload.message));
} else {
process.exit(0);
}