[Interest] QtScript Error Objects

Prashant prashant.me at gmail.com
Sun Jul 1 13:25:19 CEST 2012


Hi forum,
Making applications scriptable document describes in last the last section
about Error object. It says:
"
Error.prototype.backtrace
This function returns a human-readable backtrace, in the form of an array
of strings.
Error objects have the following additional properties:
lineNumber: The line number where the error occurred.
fileName: The file name where the error occurred (if a file name was passed
to QScriptEngine::evaluate()).
stack: An array of objects describing the stack. Each object has the
following properties:
functionName: The function name, if available.
fileName: The file name, if available.
lineNumber: The line number, if available."

I have this code which I added in qtscript helloscript
example(helloscript.js file)//does nothing but executes the program line by
line...

function bar(){

    try{ Tag.nonsense = 83 ;}

    catch (e){this.err = e; print(e instanceof Error);//true}

}

var x = bar();

print(this.err);//ReferenceError: Can't find variable: Tag

print(this.err.backtrace);//undefined

print(this.err.linenumber);//undefined

print(this.err.stack);//undefined


The outputs I have written in comments. Clearly this is a departure
from what is written in the document as the error object having those
properties. What am i missing??

Regards,
-- 
Prashant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120701/c903e476/attachment.html>


More information about the Interest mailing list