"很抱歉,发生服务器错误.请稍等,然后重试"从自定义菜单运行功能时发生错误 [英] "We're sorry, a server error occurred. Please wait a bit and try again" error when running a function from a custom menu
问题描述
我已收到341条有关以下错误的错误通知电子邮件
I have received 341 error notification emails for the below error
很抱歉,发生服务器错误.请稍等,然后重试.
We're sorry, a server error occurred. Please wait a bit and try again.
通知电子邮件仅告知发生问题的功能的名称.
The notification email only tells about the name of function in which the issue is occurring.
该脚本现在未运行.任何试图在脚本中运行任何功能的尝试都给出了以上错误.我使用脚本添加到电子表格中的自定义菜单也消失了.我找不到调试脚本的方法,因为脚本上的每个操作都会给我上述错误.
The script is not running now. Any try to run any function in the script gave the above error. Also my custom menu that i have added into the Spreadsheet using the script is gone. I found no way to debug the script as every action on the script giving me the above error.
下面是出现错误的函数
function crunchEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var gLabel = sheet.getRange("gmailLabel").getValues();
// check the current SpreadSheet for limits and create a
// new SpreadSheet if limits are approaching
checkSpreadSheet();
var gFolder = sheet.getRange("outputFolderName").getValues();
var gSpreadSheetName = sheet.getRange("outputSpreadsheetPrefix").getValues();
var threadsPerSearch = sheet.getRange("threadsPerSearch").getValues();
// Number of emails per search:
var threads = GmailApp.search("-label:" + gLabel, 0, threadsPerSearch);
for (var x=0; x<threads.length; x++) {
var messages = threads[x].getMessages();
// getting null...a thread without messages is weird
if(messages != null) {
for (var y=0; y<messages.length; y++) {
updateSpreadSheet(messages[y]);
}
}
GmailApp.getUserLabelByName(gLabel).addToThread(threads[x]);
}
}
我被困在茫茫荒野中,不知道为什么会这样吗?
I am stuck in the middle of nowhere, have no clue about why this is happening?
任何人都可以指导解决该问题吗?
Could anyone please guide to resolve the issue?
推荐答案
问题已解决.
问题出在其他一些函数中,其中有字符串替换函数.我使用带有正则表达式的字符串替换函数作为替换函数的输入.正则表达式是不正确的,由于我收到上述错误.
The problem is with string replace function in some other function. I am using the string replace function with regular expression as input to replace function. The regular expression was incorrect due which i am getting the above error.
这真的很奇怪,至少GAS应该给出一些适当的错误.
That's really weird, at least GAS should give some proper error.
这篇关于"很抱歉,发生服务器错误.请稍等,然后重试"从自定义菜单运行功能时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!