簡體   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