[Interest] How to log all JavaScript Exceptions or how to refactor QML

Richard Öhlinger r.oehlinger at avibit.com
Mon Feb 22 13:23:07 CET 2016


While developing with QML I often come across a problems relating to 
thrown JavaScript Errors.
It would help a lot to have the possibility to log all JavaScript 
exceptions.
There is QML_DUMP_ERRORS, but it won't cover the most nasty, hard to 
track down errors.

E.g.
function doSomething()
{
     var object = getSomeObject()
     var value = object.prop.function() // If property prop does not 
exist, an exeption will be thrown, but nobody will notice that instantly
     //... unreachable
     console.log(value)
}

This is a huge burden on re-factoring QML code. Easy to detect "static 
errors", which would be an compile error in c++, will be only detected 
once the appliction is tested thoroughly. There is plenty more, where a 
JavaScript exception is issued but never presented to the 
developer/user. It's not feasible to have a try-catch in every binding 
to catch errors in longer code snippets.

Is there an idea to tackle such an issue?

Thanks



More information about the Interest mailing list