Fix KAuth helper error code reporting to match documentation

Review Request #129653 - Created Dec. 15, 2016 and submitted

Information
David Edmundson
kauth
master
27bbc5e...
Reviewers
kdeframeworks
In KDElibs4 KAuth::ActionReply::errorCode returned an int.

errorCode was documented as

"The error code returned is one of the values in the ActionReply::Error
enumeration if type() == KAuthError, or is totally application-dependent
if
type() == HelperError. It also should be zero for successful replies."

In frameworks that documentation is exactly the same, however
setErrorCode and errorCode were changed to only use
the enum values in ActionReply::Error as an argument, which goes against
the documentation and is only meant to be used for internal errors, not
KAuth helpers.

Worst this leads to broken error reporting, because if one uses the new
HelperError static constructor, we have type==HelperError, but errorCode
is still 0.
This means ActionReply::failed is true, but at a KJob level, we think
the action succeeded.

Some clients are working round this by either static casting or by
incorrectly using the ActionReply::Error codes which are meant purely
for backend errors not helper errors.
Others are simply failing to report errors.

We need a fix that will support the clients which are passing an error
code back, and also fix clients which are just using
KAuth::HelperError()

This patch reintroduces the method as an integer, but changing the name
for compatibility reasons. Also a new static constructor is created that
allows one to set an error code when the AuthReply type is HelperError.

  

Issues

  • 1
  • 0
  • 0
  • 1
Description From Last Updated
There's @param but the argument doesn't have a name. Aleix Pol Gonzalez Aleix Pol Gonzalez
Aleix Pol Gonzalez
David Edmundson
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 6c7499f104300792af310e3df1122e7143aae22b by David Edmundson to branch master.
Loading...