diff --git a/bigbluebutton-html5/client/main.jsx b/bigbluebutton-html5/client/main.jsx index d5fb86231bac668c6fd9ee94dfd80ec2cb815931..89d2e423511bc4d0cea54f96a3d705d5e4304340 100755 --- a/bigbluebutton-html5/client/main.jsx +++ b/bigbluebutton-html5/client/main.jsx @@ -11,16 +11,19 @@ import Subscriptions from '/imports/ui/components/subscriptions/component'; Meteor.startup(() => { // Logs all uncaught exceptions to the client logger window.addEventListener('error', (e) => { - const { stack } = e.error; - let message = e.error.toString(); + let message = e.message || e.error.toString(); + + // Chrome will add on "Uncaught" to the start of the message for some reason. This + // will strip that so the errors can hopefully be grouped better. + if (message) message = message.replace(/^Uncaught/, '').trim(); + + let { stack } = e.error; // Checks if stack includes the message, if not add the two together. - if (stack.includes(message)) { - message = stack; - } else { - message += `\n${stack}`; + if (!stack.includes(message)) { + stack = `${message}\n${stack}`; } - logger.error({ logCode: 'startup_error' }, message); + logger.error({ logCode: 'startup_error', stackTrace: stack }, message); }); // TODO make this a Promise