function fc () {
var x = 11
var y = x.toString()
return y
}
I execute this in a script file bound to a spreadsheet,
and get a the following error message:
We're sorry, a server error occurred. Please wait a bit and try again.
If I execute that same function in another script file,
it works as expected, without error message.
The same happens with "simply" changing x to string:
var x = "11"
There may be an "easy" explanation but while you are at it, it feels
like living a Gary Larson-Cartoon ...
I just ran that script with no problems. I think I've had that error msg before for something that didn't have anything to do with the server. It's impossible to capture every possible error perfectly. Once in a while you get a misleading error. I'm not saying that definitely is the situation, but just keep it in mind.
You have to go through the debugging process. I've had to comment out large sections of code many times and go back to the beginning to trace errors. Sometimes that's the only way. Start commenting out code until you get something to run without an error, then add lines back in until another failure.
Related
The following code works perfectly if run normally
function initialPopulation()
{
var group = ContactsApp.getContactGroup('clients');
var myContacts = ContactsApp.getContactsByGroup(group);
for (var i=0;i<myContacts.length;i++)
{
var row = i+1;
var getPrimaryEmail = myContacts[i].getPrimaryEmail();
ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
ss.getRange("A"+row).setValue(getPrimaryEmail);
var temp=0;
}
}
If I debug the code, without any stops, it also runs perfectly without issues.
However, if I try to debug the code, with a stop on the line "temp=0", then continue to debug, it will always crash:
We're sorry, a server error occurred. Please wait a bit and try again.
(line 10, file "Code")
Line 10 is:
var getPrimaryEmail = myContacts[i].getPrimaryEmail();
Any ideas what could be happening?
This is driving me crazy because I cannot debug more complex code.
I can confirm this, even in an older script that I am fairly certain I have previously single-stepped through. What a show-stopper.
Further, you can reproduce the same error with .contact.getEmails(), so my bet is that a bug has been introduced. No sign of it on the issue tracker, unless you count Issue 5502.
I recommend raising a new issue. (Done: Issue 5515.)
In the mean time, you can work around the problem by NOT single stepping over methods like this one that the debugger can't unspool. That means that you cannot have any breakpoints BEFORE the fatal line, as it will die on continuation.
I am making an R-script to get all of the mentions (#username) of a specific set of users.
My first issue isn't a big deal. I try to work at home, as well as work. At work, the code works fine. At home, I get Error 32 - Could not authenticate you from Oauth. This is using the exact same code, key, secret, token. I have tried resetting my secret key/token, same thing. Not a problem, since I can do remote login, but its frustrating.
The REAL issue here...
I construct a URL (ex: final_url = "https://api.twitter.com/1.1/search/tweets.json?q=#JimFKenney&until=2015-10-25&result_type=recent&count=100")
Then I search twitter for my query of #usernameDesired to get all the comments where they were mentioned.
mentions = GET(final_url, sig)
This works fine, but then I want my data in a usable format so I do...
library(rjson)
#install.packages("jsonlite", repos="http://cran.rstudio.com/")
library(jsonlite)
#install.packages("bit64", repos="http://cran.rstudio.com/")
json = content(mentions)
I then get the following error -
$statuses
Error in .subset2(x, i, exact = exact) : subscript out of bounds
I don't have even the first idea of what can be causing this.
Any help is gratly appreciated.
EDIT 1: For Clarity, I get the error when trying to see what is in json. If I do "json = content(mentions)" that line of code executes fine. I then type "json" to see what is in the variable, and I get the above error that starts with $statuses.
While using MailCore2, I started getting an error in MCHTMLCleaner.cc and method HTMLCleaner::cleanHTML. The specific line that is throwing the error is:
rc = tidySetErrorBuffer(tdoc, &errbuf);
and the error being printed is:
'Assertion failed: (option_defs[ optId ].type == TidyInteger), function SetOptionInt, file ../../src/config.c, line 381'
In config.c on line 381 is:
Bool status = ( optId < N_TIDY_OPTIONS );
Occasionally, this will crash the app, which seems contrary to the entire idea of a try/catch block that would make the most sense here.
More often than not, this code/file will not stop the app and instead just print out an error.
What is causing this to crash? Has anyone else experienced this? IS the HTML actually being cleaned or is nothing being returned for you?
Here is a link to the specific file in question on GitHub.
This error appeared when running functions that had not been altered since they had last run successfully and, when moved to another project, ran without generating any error messages.
The error message appeared no matter which function was run and even persisted when I got to the stage of removing all but the simple function below from the project:
function foo() {
Logger.log('bar');
}
Usually that error message gives a line number but it didn't in this case.
What could cause that?
In my case it was a wrong assignment in an if statement
WRONG CODE
if (tasks[ti].hasOwnProperty("category") && tasks[ti].hasOwnProperty("opportunityId") && tasks[ti].category="Meeting" && now.getYear()==closingYear && now.getMonth()==closingMonth ){
// ^^ right there, should be comparison
closedMeetings.push(tasks[ti]);
}
RIGHT CODE
if (tasks[ti].hasOwnProperty("category") && tasks[ti].hasOwnProperty("opportunityId") && tasks[ti].category=="Meeting" && now.getYear()==closingYear && now.getMonth()==closingMonth ){
closedMeetings.push(tasks[ti]);
}
The awful part was that it said the mistake was on Line 1 and this code was at line 236
The error was actually in a library that was referenced as a resource by the project. I initially thought I had ruled that out by commenting out the library function but not so.
Presumably the lack of a line number should have been a hint that the error was in an external resource. I'll know in future.
I'm answering my own question in the hope that it will save someone wasting the amount of time I've just wasted trying to locate the source of the problem.
I run a PHP script which does a lot of mysql work
At some point mysql fails, without printing any errors
I'd like to go then to mysql from console, and ask it what was the last error.
How can I do it?
(I'm aware of php's mysql_error(), but I'm looking for mysql command that I can run directly independently of a php script)
You can run
SHOW ERRORS;
And a similar useful one is:
SHOW WARNINGS;
EDIT
Apparently this will only show errors (or warnings) from your own sessions. So I guess it will not suit your purpose (using console to find errors caused by php).
Anyway, you can read the manual for more info (it says nothing about cross session error logging): http://dev.mysql.com/doc/refman/5.0/en/show-warnings.html
I understand that it's too late, but suddenly someone will find this question just like me ...
For better debugging, you can save the MySQL query to a text file on the server.
For example, before the request:
$mysql->query("Select x from y where y.x = ".$_GET['yx']);
Write the following lines:
error_log("Select x from y where y.x = ".$_GET['yx']);
And after that you will be able to see all database requests from different sessions in text file.
For better experience:
if (!$mysql->query("Select x from y where y.x = ".$_GET['yx']))
error_log("Select x from y where y.x = ".$_GET['yx']);
else
{
you code here...
}