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

Kandeler Christian Christian.Kandeler at theqtcompany.com
Sat Mar 26 20:38:47 CET 2016


No exceptions must ever pass the API boundary. Please file a bug report.


Christian

________________________________
From: QBS <qbs-bounces+christian.kandeler=theqtcompany.com at qt-project.org> on behalf of Thomas Epting <thomas.epting.stryker at gmail.com>
Sent: Saturday, March 26, 2016 12:31 PM
To: qbs at qt-project.org
Subject: [QBS] QtCreator crashes in case of any error in setupRunEnvironment

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: {

        spark

    }


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 QtCreator.

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


        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) {

            QbsManager::logSink()->printWarning(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?

Thanks,
Thomas

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


More information about the Qbs mailing list