Getting the error message from v8::Script::Compile() - c++

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.

Related

Assert failed in OnInitDialog()

So I have an "assertion failed" error message when I want to run my program. I understand that it means that somewhere a condition that should be true isn't but I don't know how to correct that.
The error concerns the following line :
_AFXWIN_INLINE BOOL CEdit::SetReadOnly(BOOL bReadOnly)
{ ASSERT(::IsWindow(m_hind)); return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); }
So I get that it's about the "Read Only" condition, but I don't know where to correct that.
I am new in C++, so sorry if I forgot to put important information in my question.
Thanks in advance!
The OnInitDialog function contains a call to the base class function
CDialog::OnInitDialog();
Move your calls to SetReadOnly to after that line. The edit control variables are only initialized after that line.
Thank you for your help! Finally, after going through the whole code line by line, I realized in DoDataExchange I mixed up and put twice the same variable at some point instead of two different ones ... So I don't really know how that got me that error but I thought I'd keep you updated in case someone makes the same absent-minded mistake and gets that error :)

suppress wxFileName::Normalize error messages

I have the following c++ code that used to normalize user supplied file path:
wxString orig_path;
wxFileName res_path(orig_path);
res_path.Normalize(wxPATH_NORM_DOTS);
Refs:
wxFileName::Normalize
wxFileName::Normalize flags
When:
orig_path = "../../dir1/f.csv"
I get annoying error messages:
Error: The path 'f.csv' contains too many ".."!
When:
orig_path = "dir1/../dir2/f.csv"
everything works as expected.
Question
Any way I can suppress those error messages? (silent flag?).
I guess I can do some processing myself before calling Normailze but what's the point? I prefer not to do anything or know anything about orig_path before calling Normailze
Use wxLogNull. All calls to the log functions during the life time of an object of this class are just ignored.
See documentation.
wxLogNull noLogsPlease;
wxString orig_path;
wxFileName res_path(orig_path);
res_path.Normalize(wxPATH_NORM_DOTS);

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.

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

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.

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.