Vexi PlatformVexi Platform
vexi: easy, extensible, flexible

Thursday, September 20, 2007

Debugging Vexi Applications I

Most scripting languages are very hard to debug, especially as the code becomes complex and the variety of files and structures interacting with eachother becomes somewhat hard to have mapped in the mind.

Fortunately VexiScript has kept some neat features from Java and some features of it's own that make debugging complex Vexi applications fairly easy! For instance, a full stack trace with line numbers always accompanies an exception.

Of course, it may be that you don't want to stop executing code to get an idea of where your code is up to. In VexiScript, we can also throw and more importantly catch exceptions, much like in Java - but in VexiScript these exceptions are really easy to handle - just pass them to a vexi.log function and it will handle the rest.

if (myval != correctval) {
    try { throw "incorrect myval: "+myval; }
    catch(e) { vexi.log.info(e); } // that's it!
}
// and the script continues uninterrupted

It is as easy as that. ;-)

No comments: