Skip to content

SharedQmlEngine: Improve error reporting when loading main component

ivan tkachenko requested to merge work/ratijas/fail-to-incubate into master

Initial page component follows somewhat more complicated rules. Not only it has a QQmlComponent that may fail to load, but it has also QQmlIncubator which may fail to instantiate an otherwise valid and loaded component. For example, the incubator may fail if KCM's main.qml top-level component has required properties.

SharedQmlEngine::status implementation was some weird algorithm, and the actual status is not what the only consumer is interested in, so I got rid of it in favor of isError/errorString pair.

As a drive-by cleanup, component and incubator's status() comparisons were replaced with dedicated named predicates like isReady & isError.

Test plan: mess up some KCM implementation. For example, in flatpak-kcm put a required property bool hello line in main.qml. KCM shell should fail to load KCM as a whole, and display a standard error KCM instead with an error text about uninitialized required property (and the same error should be printed to the console output). Then revert main.qml, and put that line in permissions.qml instead (which is a second page). Now the KCM should load the first page, but the same formatted error should be printed to the console about the second page.

Merge request reports