MailCore2 MCHTMLCleaner error - html

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.

Related

2to3 bug: tuple index out of range, fix_raise

I have found what looks like a not tested case to me. When trying to convert following code with 2to3:
def test(arg):
raise()
The execution stops ungracefully with no indication why, nor what file caused the problem, this is very annoying if you are trying to convert a whole folder of python 2 scripts. The following is thrown:
...
exc= exc.children[1].children[0].clone()
IndexError: tuple out of range
I am expecting to obtain a BadInput exception. Clearly, given the source code just above, it is expecting raise("something") and since there is no check that "children" inside the tuple of raise () is even present, this causes error.
Please correct me if I am wrong, of course raise() is incorrect, but this should not crash the execution, likewise the following:
def test(arg):
print 1.method()
Throws BadInput exception with a clear indication what happened.

Cause of boto3 error "An error occurred (Unavailable)...Tags could not be retrieved"?

I just started getting this error on a script that hasn't changed. Updating to boto3==1.4.3 had no effect. Doesn't look like throttling, does it? Not sure where to go with this one, any suggestions would be much appreciated.
File "/Library/Python/2.7/site-packages/botocore/client.py", line 251, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Library/Python/2.7/site-packages/botocore/client.py", line 537, in _make_api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (Unavailable)
when calling the DescribeSecurityGroups operation (reached max retries: 4):
Tags could not be retrieved.
Edited to add: As noted in comment below, this is coming from a seemingly innocuous call to describe_security_groups().
Another update: OK, this was transient and is no longer happening. Le sigh. Maybe some timeout due to network issues or something. I'll leave it up on SO for now, in case someone sees this and has a flash of insight.

toString() produces Server error - Code execution mysteries

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.

What could cause "Invalid assignment left-hand side." error message that doesn't show line number?

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.

BeepBeep and ErlyDB integration issue

Further to my adventures with Erlang and ErlyDB. I am attempting to get ErlyDB working with BeepBeep
My ErlyDB setup works correctly when run outside of the BeepBeep environment (see Debugging ErlyDB and MySQL). I have basically take the working code and attempted to get it running inside BeepBeep.
I have the following code in my controller:
handle_request("index",[]) ->
erlydb:start(mysql,Database),
erlydb:code_gen(["thing.erl"],mysql),
NewThing = thing:new_with([{name, "name"},{value, "value"}]),
thing:save(NewThing),
{render,"home/index.html",[{data,"Hello World!"}]};
When I call the URL, the response outputs "Server Error".
There is no other error or exception information reported.
I have tried wrapping the call in try/catch to see if there is an underlying error - there is definitely an exception at the call to thing:new_with(), but no further information is available.
The stacktrace reports:
{thing,new,[["name","value"]]}
{home_controller,create,1}
{home_controller,handle_request,3}
{beepbeep,process_request,4}
{test_web,loop,1}
{mochiweb_http,headers,4}
{proc_lib,init_p_do_apply,3}
Use pattern matching to assert that things work up to the call to thing:new/1:
ok = erlydb:start(mysql,Database),
ok = erlydb:code_gen(["thing.erl"],mysql),
You include only the stack trace, look at the exception message as well. I suspect that the error is that you get an 'undef' exception. But check that it is so. The first line in the stack trace indicates that it is a problem with calling thing:new/1 with ["name", "value"] as argument.
It is slightly odd that you show one clause of handle_request that is not calling home_controller:create/1 as per {home_controller,create,1} in the stack-trace. What do the other clauses in your handle_request/2 function look like?