Hi,
I need an equivalent function in QJSEngine for the following code in QScriptEngine:-
Code:
return context->throwError( QScriptContext::SyntaxError, "Invalid Value");
I could not find any usefule function in QJSEngine docs to throw an error.
Printable View
Hi,
I need an equivalent function in QJSEngine for the following code in QScriptEngine:-
Code:
return context->throwError( QScriptContext::SyntaxError, "Invalid Value");
I could not find any usefule function in QJSEngine docs to throw an error.
I know it is not the same thing, but http://doc.qt.io/qt-5/qqmlengine.html#qmlInfo can be used to print related warning.
Cheers,
_
Thanks anda_skoa i can check on that and let you know but the real killer is in LiScriptEngine we have QScriptSyntaxCheckResult QScriptEngine::checkSyntax(const QString & program) which is more useful to identify the type of error occured when engine executes a program.But in JSEngine the return value is JSValue where we cannot identify the type since there is no real error object in JSEngine.On going through the docs i can see functions like isError() and some properties of error like line,stack,name... but none of this is equivalent to checkForSyntax.Any idea on this problem or this is not possible in JSEngine.
Ah, interesting, didn't know about checkSyntax().
My guess is that nobody has needed that yet in QJSEngine so nobody has added it yet.
Cheers,
_