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

Christian

________________________________
From: QBS <[email protected]> on 
behalf of Thomas Epting <[email protected]>
Sent: Saturday, March 26, 2016 12:31 PM
To: [email protected]
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

_______________________________________________
QBS mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs

Reply via email to