From 9d9528798f8468d6f98472ec5f260ec301ff9eec Mon Sep 17 00:00:00 2001
From: KDSBrowne <kert.browne85@gmail.com>
Date: Wed, 29 Apr 2020 16:34:37 +0000
Subject: [PATCH] Add client logger and error code messages

---
 .../presentation/presentation-uploader/component.jsx | 12 ++++++++++++
 .../presentation/presentation-uploader/service.js    |  8 +++++++-
 bigbluebutton-html5/private/locales/en.json          |  3 +++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx
index b4f18ed1f9..3accda49dd 100755
--- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx
@@ -101,6 +101,18 @@ const intlMessages = defineMessages({
     id: 'app.presentationUploder.upload.413',
     description: 'error that file exceed the size limit',
   },
+  408: {
+    id: 'app.presentationUploder.upload.408',
+    description: 'error for token request timeout',
+  },
+  404: {
+    id: 'app.presentationUploder.upload.404',
+    description: 'error not found',
+  },
+  401: {
+    id: 'app.presentationUploder.upload.401',
+    description: 'error for failed upload token request.',
+  },
   conversionProcessingSlides: {
     id: 'app.presentationUploder.conversion.conversionProcessingSlides',
     description: 'indicates how many slides were converted',
diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js
index d8a1b01a5a..a013b19773 100644
--- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js
+++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js
@@ -3,6 +3,7 @@ import PresentationUploadToken from '/imports/api/presentation-upload-token';
 import Auth from '/imports/ui/services/auth';
 import Poll from '/imports/api/polls/';
 import { makeCall } from '/imports/ui/services/api';
+import logger from '/imports/startup/client/logger';
 import _ from 'lodash';
 
 const CONVERSION_TIMEOUT = 300000;
@@ -171,7 +172,12 @@ const uploadAndConvertPresentation = (
     .then(() => observePresentationConversion(meetingId, file.name, onConversion))
     // Trap the error so we can have parallel upload
     .catch((error) => {
-      console.error(error);
+      logger.debug({
+        logCode: 'presentation_uploader_service',
+        extraInfo: {
+          error,
+        },
+      }, 'Generic presentation upload exception catcher');
       onUpload({ error: true, done: true, status: error.code });
       return Promise.resolve();
     });
diff --git a/bigbluebutton-html5/private/locales/en.json b/bigbluebutton-html5/private/locales/en.json
index 0e17ddb52b..711a6ff365 100755
--- a/bigbluebutton-html5/private/locales/en.json
+++ b/bigbluebutton-html5/private/locales/en.json
@@ -171,6 +171,9 @@
     "app.presentationUploder.rejectedError": "The selected file(s) have been rejected. Please check the file type(s).",
     "app.presentationUploder.upload.progress": "Uploading ({0}%)",
     "app.presentationUploder.upload.413": "File is too large. Please split into multiple files.",
+    "app.presentationUploder.upload.408": "Request upload token timeout.",
+    "app.presentationUploder.upload.404": "404: Invalid upload token",
+    "app.presentationUploder.upload.401": "Request presentation upload token failed.",
     "app.presentationUploder.conversion.conversionProcessingSlides": "Processing page {0} of {1}",
     "app.presentationUploder.conversion.genericConversionStatus": "Converting file ...",
     "app.presentationUploder.conversion.generatingThumbnail": "Generating thumbnails ...",
-- 
GitLab