[QBS] QtCreator crashes in case of any error in setupRunEnvironment

Thomas Epting thomas.epting.stryker at gmail.com
Sat Mar 26 12:31:42 CET 2016

In case there is any non-syntactical problem with a module's
setupRunEnvironment script, QtCreator crashes immediately. As a trivial
example, use a module that has a setupRunEnvironment script like this:

    setupRunEnvironment: {



The reason for the crash is that qbs::RunEnvironment::runEnvironment throws
a qbs::ErrorInfo exception ("Error while setting up run environment:
ReferenceError: Can't find variable: spark") that is never catched in

As a quick fix, I added a try/catch block in

        try {

            procEnv = qbsRunEnv.runEnvironment();

            if (!procEnv.isEmpty()) {

                env = Utils::Environment();

                foreach (const QString &key, procEnv.keys())

                    env.set(key, procEnv.value(key));


        } catch (const qbs::ErrorInfo &errInfo) {



But I'm unsure if that's the way it's meant to be. It looks like all other
Qbs exceptions are catched within Qbs itself and sent to the log sink. So
this could either be treated as a bug in QtCreator or in Qbs.

Any advice on how to deal with exceptions at the public API of Qbs?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20160326/771454bc/attachment.html>

More information about the Qbs mailing list