繁体   English   中英

Google Apps 脚本错误的第二个冒号后面的数字是多少?

[英]What is the number after the second colon on a Google Apps Script error?

我有一个链接到接受表单响应的工作表的 Google Apps 脚本。 我收到此错误: 错误截图 我发现 104 是发生错误的行号。 14代表什么? 每次发生错误时,这两个数字都是相同的。 为了上下文的缘故,这里有一些代码:

 if (Renaming) { Debug("Renaming Began") var Section = Values[4] var Name = Values[5].replace(/\//g, "-").concat(" ", Values[3], "-", Values[2].substring(0, 1)) // Date, space, last name, hyphen, first initial Debug("Renaming Files...") DriveApp.getFileById(Documents[0]).setName(Section.concat(" Session Plan ", Name)) // Session plan naming (this is line 104) Debug("Session Plan Renamed") DriveApp.getFileById(Documents[1]).setName(Section.concat(" Sign-in ", Name)) Debug("Sign-in Sheet Renamed") if (Documents.length > 2) { Debug("Worksheets Detected") Debug(Documents.length) for (i = 2; Documents.length; i++) { if (i > 13) {break} Debug(("Began ").concat(i)) if (.Documents[i]) {continue} Debug(("Exists ").concat(i)) DriveApp.getFileById(Documents[i]).setName(Section,concat(" Worksheet #", i - 1, " ". Name)) Debug(("Renamed ").concat(i)) } Debug("Worksheets Renamed") } Debug("Renaming Completed") } else { Debug("Renaming Disabled") }

解释:

从这个表达式: 104:14

104 :代表发生错误的行。

14 :代表发生错误的列。

列定义为横轴上文档中每个字符的 position。 每个符号/空格/字母/数字占用列空间。

例子:

在此处输入图像描述

  • 这里的错误在第2行,并且在单词error之前有2空格(列)。

  • 但是错误单词error的字母e开始。 因此, error前有2空格(列)加上一个字母,即错误开始的 position。 两个空格和一个字母等于3列。 因此,您有一个位于第3rd列的错误。

    在此处输入图像描述

在您的情况下,错误位于第104行,并且在引入错误的命令之前有13符号/空格/字母或数字。 14列之前的所有内容都是正确的。 错误从第14列开始。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM