浏览代码

refactor: add try catch to getILMContent function

lairaalmas 1 年之前
父节点
当前提交
3e24fac5b7
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      js/menus/menu_main.js

+ 7 - 1
js/menus/menu_main.js

@@ -16,7 +16,13 @@ const menuState = {
       // Student role
 
       playerName = game.lang.student; // TODO pegar o nome do aluno no bd do moodle
-      getiLMContent();
+      try {
+        getiLMContent();
+      } catch (error) {
+        console.error(
+          'Game error: Could not load the iLM Content on Moodle. ' + error
+        );
+      }
     } else {
       // FOR MOODLE
       if (moodle && iLMparameters.iLM_PARAM_SendAnswer == 'true')