Chrome控制台中的Google Apps脚本未捕获错误 [英] Google Apps Script uncaught error in Chrome Console

查看:55
本文介绍了Chrome控制台中的Google Apps脚本未捕获错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作表上有一个简单的数据输入工具,它是HTML表单,然后它遍历表单中的字段并将其发布到工作表中.该实用程序在我的家用计算机上绝对可以正常工作.我注意到当一位同事尝试时,它失败了.我检查了他的控制台,发现了一个未捕获的错误.我在工作计算机上尝试了该实用程序,但它也无法将值推送到工作表中.几乎像google.script.run函数存在某种类型的问题?我曾在其他网络上为其他人工作过.附件是它在Chrome控制台中的内容.不是非常描述性或有用的错误.我没有在家用计算机上得到它.

I have a simple data entry tool on my Sheet that's an HTML form and then it runs through the fields in the form and posts them to the sheet. The utility works absolutely fine on my home computer. I noticed when a colleague tried it, it failed. I checked his console and there was an uncaught error. I tried the utility on my work computer and it also failed to push the values to the sheet. Almost like there is some type of issue with the google.script.run function? I have had it work for others on different networks. Attached is what it throws in the Chrome console. Not a very descriptive or useful error. I don't get this on my home computer.

我的JavaScript:

My JavaScript:

<script>
  // Prevent forms from submitting.
  function preventFormSubmit() {
    const forms = document.querySelectorAll('form');
    for (var i = 0; i < forms.length; i++) {
      forms[i].addEventListener('submit', function(event) {
      event.preventDefault();
      });
    }
  }
  window.addEventListener('load', preventFormSubmit);
  
  function handleFormSubmit(formObject) {
      $("#formType").val($('title').text());
      google.script.run.processForm(formObject);
      $(".selectpicker").val("default"); // Reset select
      $(".selectpicker").selectpicker("refresh"); // Refresh select
      $("input").val(""); // Reset input values
      $("textarea").val(""); // Reset input values
      $("#waiver").parents().eq(1).css({ display: "none" });
      if ($('title').text() === "PT Credit") {
          var table = $("#credit_table")
          table.parent().css({ display: "none" });
          table.empty();
      }
  }
</script>

推荐答案

检查您的Apps脚本执行

经过一些试验,我发现无论何时我在客户端控制台中出现 uncaught 错误,都是因为服务器端Apps脚本功能之一失败了.

Check your Apps Script Executions

After some experimenting I have found that whenever I had an uncaught error in the client console, it was always because one of the server side Apps Script functions were failing.

转到script.google.com>我的处决权

Go to script.google.com > My Executions

或者到您的特定项目,执行页面:

Or to your specific project, the executions page:

由于该错误仅出现在另一个系统上,因此很可能与帐户有关.尽管在执行页面中应该有更多有关失败原因的信息.

Seeing as the error only appears on another system, it is likely to be account related. Though there should be more info in the executions page as to why it failed.

这篇关于Chrome控制台中的Google Apps脚本未捕获错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆