If CHttpConnection::OpenRequest returns NULL how do I find out why - c++

c++
mfc
if CHttpConnection::OpenRequest returns a null what can I use to get the internet error.
The mfc artical doesn't say what a bad responce looks like. I just said it returns a handle to a CHttpFile.

Did you see what is the error code returned by GetLastError() ? Get the error code and perform a error lookup (Tools->Error Lookup) to get the description about the code. Normally you will get the exact reason for the failure using this.

Related

SerialPortError in QSerialPort 5.2?

How can I use SerialPortError to get a human readable text in QSerialPort 5.2? The only thing I know is error() returns enum. I have the list of the errors in Qt documentation. I don't want to reinvent the wheel. For example, 1 indicates accessing to non existed port.
QIODevice, the parent class of QSerialPort, has an errorString() method. The documentation states:
Returns a human-readable description of the last device error that occurred.
Unfortunately, a quick glance through the code reveals that QSerialPort does not set the error string when it sets the error code. It looks like you will need to generate the error strings yourself.
errorString() may still return a valid error string if the error was set by QIODeivce instead of QSerialPort.

Getting the error message from v8::Script::Compile()

I'm calling Script::Compile() and it returns me an empty handle as result. I've traced into this method and finally found that
i::Handle<i::SharedFunctionInfo> result = i::Compiler::Compile(str, ....
is returning the empty handle. That means compilation error.
But does anyone know is there a way to get error message from compuler in this case to get know where error has occured?
Take a look at the ReportException function in the Shell example. You need to use a v8::TryCatch to capture the exception and report on the error.

Error with addstoredproc method in cfscript

I am calling a stored procedure with cfscript, but when I add the addProcResult method to the call, ColdFusion returns the error The specified key, result, does not exist in the structure. Removing the method fixes the error and doesn't effect the results, but I still would like to know why the error appeared. Using <cfstoredproc> and <cfprocparam> doesn't generate the error. I am running CF9. My code is below.
spService = new storedProc();
spService.setDatasource("mydb");
spService.setProcedure("someSP");
spService.setUsername("TaskRunner");
spService.setPassword("password");
spService.addProcResult(name="result",resultset=1);
spService.execute();
You'll get this error if your stored procedure actually doesn't return a resultset (perhaps it returns an output parameter--or nothing at all).
Simply remove the call to .addProcResult(), and you'll be fine.

IXSLTemplate::putref_stylesheet returns E_INVALIDARG

Well, it's been several hours I'm lost...
IXSLTemplate::putref_stylesheet doesn't document any error except E_FAIL.
However in my case putref_stylesheet returns E_INVALIDARG. GetErrorInfo() is only redundant telling me that the "Argument is invalid". So I am not left with much information.
However my code is pretty close to all examples I found on the web and msdn.
And it does something like:
void xsltProcessing(MSXML2::IXMLDOMDocument* pXmlDoc, MSXML2::IXMLDOMDocument * pXslDoc)
{
IXSLTemplatePtr pTemplate;
pTemplate.CreateInstance( _T( "Msxml2.XSLTemplate" ));
pTemplate->putref_stylesheet(pXslDoc);
//...
}
As there is not much documentation for putref_stylesheet. Do you have any idea what could go wrong for it to return E_INVALIDARG ?
My pXslDoc is a IXMLDOMDocument I have loaded from static const strings with success.
Any clue ? ( I guess it's pretty vague a question, but it's been hours I am searching )
Are you loading pXslDoc asynchronously perhaps?
The default behaviour for IXMLDOMDocument objects is to load asynchronously, so it is possible that the pXslDoc has not finished loading when you call putref_stylesheet().
Adding the following code before you load pXslDoc would fix this problem, if it is what you are suffering from:
pXslDoc->put_async(VARIANT_FALSE);

Problem with getting error description after SSL_CTX_new returned NULL

I am very new to SSL , Actually I would say I know nothing about it.
I am using the method "SSL_CTX_new" to create an SSL_CTX object. The method returns null.The documentation says I can check the error stack in order to get the cause for this.
So I have the function "int SSL_get_error(SSL *s,int ret_code)" which (as I understand) I have to use in order to get the error message. the documentation of the method says nothing about the first parameter of the function. It only says that the second ("ret") parameter should be equal to the return code from the failed operation which can be any of the following :
SSL_connect(), SSL_accept(), SSL_do_handshake(), SSL_read(), SSL_peek(), or SSL_write()
So now I am having two problems. The first is that I didn't use any of those functions but rather use SSL_CTX_new that doesn't return any kind of return code (it returns a pointer to SSX_CTX object) So i don't know what to put as the "ret" parameter. The second problem is that I don't know what does the first parameter mean and what should I put there , because the doc says nothing about it.
You need a valid context to create the SSL object.
Since you can't create a context you can't use SSL_get_error.
Try using ERR_print_errors to see what's gone wrong
#include "openssl/err.h"
...
SSL_CTX * ctx = SSL_CTX_new(....);
if(!ctx) {
ERR_print_errors_fp(stderr);
//throw or return an error
}
I just had a read of the SSL docs. If you need to programatically get the error code / error string you should use the ERR_get_error and ERR_error_string functions.
Have a look here and here
As per http://www.mail-archive.com/openssl-users#openssl.org/msg51543.html, you may be missing a call to SSL_library_init(). Adding this before the SSL_CTX_NEW(..) call fixed the NULL value problem for me.