Move implementation of hasError and setHasError to iplugin
ClosedPublic

Authored by volden on Jul 16 2016, 2:24 PM.

Details

Summary

Move the implementation of hasError and setHasError to iplugin. They are basically just getter/setters and actual implementation belong there - not in the individual plug-ins.
Unified the way plug-ins report errors when failing.

There is a separate patch for plug-ins in Kdevelop repository.

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
volden updated this revision to Diff 5227.Jul 16 2016, 2:24 PM
volden retitled this revision from to Move implementation of hasError and setHasError to iplugin.
volden updated this object.
volden edited the test plan for this revision. (Show Details)
volden added a reviewer: KDevelop.
volden set the repository for this revision to R33 KDevPlatform.
volden added a subscriber: kdevelop-devel.
apol added a subscriber: apol.Jul 16 2016, 10:59 PM

I'm not sure why you did it though...? Isn't it largely a matter of taste?

Where's the errorDescription being used?

interfaces/iplugin.cpp
198

Would it make sense to limit the hasError to whether there's an errorDescription? The only advantage otherwise is to be able to have a failing plugin without a message.

In D2192#40618, @apol wrote:

I'm not sure why you did it though...? Isn't it largely a matter of taste?

Long story short: I did this patch in relation to some other work I was doing with regard to loading the plugins (I will post that as another review request when the fate of this has been decided.).

As such I agree: There is an element of taste in this patch. But I do think it brings some value to the code:

  • More uniform implementation of errorHandling across plugins
  • Better and more uniform messages to the log

Where's the errorDescription being used?

The errorDescription is being used when we are trying to load a plugin and it for some reason fails. errorDescription will be written to the log.

apol added inline comments.Jul 18 2016, 1:09 PM
interfaces/iplugin.cpp
200

This should imply setHasError(true).

volden updated this revision to Diff 5275.Jul 18 2016, 2:35 PM

Adressed Aleix review points

apol accepted this revision.Jul 18 2016, 4:00 PM
apol added a reviewer: apol.

LGTM. Thanks!

plugins/perforce/perforceplugin.h
143

unrelated change

This revision is now accepted and ready to land.Jul 18 2016, 4:00 PM
apol added inline comments.Jul 18 2016, 4:06 PM
interfaces/iplugin.h
227 ↗(On Diff #5275)
/**
    * Set a @p description of the error encountered. An empty error 
    * description implies no error in the plugin.
    */
   void setErrorDescription(const QString &description);
This revision was automatically updated to reflect the committed changes.
volden marked an inline comment as done.