Warn if KPackage is invalid
ClosedPublic

Authored by broulik on Sep 4 2019, 4:50 PM.

Details

Summary

Previously it would warn about no "mainscript" having been provided but all paths are empty for an invalid package.
Print a more appropriate error message about the kpackage itself being invalid.

Test Plan

Tried a new KCM which had a folder missing, got a better error message now

Diff Detail

Repository
R296 KDeclarative
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Sep 4 2019, 4:50 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptSep 4 2019, 4:50 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Sep 4 2019, 4:50 PM
ngraham added a subscriber: ngraham.Sep 4 2019, 6:07 PM

+1 in concept. Is there any more verbose information we can get though? Like specifically how the package is invalid?

apol added a subscriber: apol.Sep 5 2019, 12:02 AM
apol added inline comments.
src/quickaddons/configmodule.cpp
174

maybe put it after checking the mainscript? the "no QML file provided" error is more accurate. We can keep ::isValid as a fallback.
Actually, if there's no mainscript it probably shouldn't be valid.

broulik added inline comments.Sep 5 2019, 6:36 AM
src/quickaddons/configmodule.cpp
174

Is "mainscript" mandatory?

In any case, if your package has the incorrect folder structure, it previously printed "no QML file provided" which is super misleading as it suggests the config entry is missing which it usually isn't.

apol accepted this revision.Sep 5 2019, 1:00 PM

Let's consider it an iteration though.

src/quickaddons/configmodule.cpp
174

¯\_(ツ)_/¯

If that's the case...

Maybe we could see to passing a string ref argument to isValid? Or adding a Package::errorString method (that will likely dupe all the logic).

This revision is now accepted and ready to land.Sep 5 2019, 1:00 PM
This revision was automatically updated to reflect the committed changes.