package daemon: Rework error and issue propagation to client
* BDaemonClient: Move inner class BCommitTransactionResult to top level
and make it public.
* BCommitTransactionResult:
- Add a whole bunch of specific error code enum values. Such an error
code is now the primary error, as opposed to before where we would
mix status_t and enum value errors. There's a systemError property
of type status_t which may provide additional information, though
(depending on the primary error type).
- Remove the errorMessage property. Due to mapping all errors to the
specific error codes this is no longer necessary. Mixing such a
message with another error description is also not very helpful when
it comes to localization (still not supported, though).
- Add several properties (paths, strings, error codes) that serve as
arguments to the primary error and are used by FullErrorMessage().
- Add issues property, a list of instances of new class
BTransactionIssue. Those describe non-critical issues (e.g. failed
update of a settings file) that occurred in the process of
committing the transaction. Those issues should be presented to the
user by the package management program.
* Exception: Adjust to transport the BCommitTransactionResult
properties.
* CommitTransactionHandler, FsTransactions, Root, Volume: Adjust to
BCommitTransactionResult/Exception changes.
* CommitTransactionHandler: Now requires a BCommitTransactionResult to
which it adds the issues it encounters. The reply BMessage is no
longer needed, though.
* Volume: Refactor common code from the three methods that use
CommitTransactionHandler into new method _CommitTransaction.
This commit is contained in:
@@ -22,6 +22,7 @@ class BDirectory;
|
||||
namespace BPackageKit {
|
||||
|
||||
|
||||
class BCommitTransactionResult;
|
||||
class BInstallationLocationInfo;
|
||||
class BPackageInfoSet;
|
||||
|
||||
@@ -33,9 +34,6 @@ class BActivationTransaction;
|
||||
|
||||
|
||||
class BDaemonClient {
|
||||
public:
|
||||
class BCommitTransactionResult;
|
||||
|
||||
public:
|
||||
BDaemonClient();
|
||||
~BDaemonClient();
|
||||
@@ -65,41 +63,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class BDaemonClient::BCommitTransactionResult {
|
||||
public:
|
||||
BCommitTransactionResult();
|
||||
BCommitTransactionResult(int32 error,
|
||||
const BString& errorMessage,
|
||||
const BString& errorPackage,
|
||||
const BString& oldStateDirectory);
|
||||
~BCommitTransactionResult();
|
||||
|
||||
void SetTo(int32 error, const BString& errorMessage,
|
||||
const BString& errorPackage,
|
||||
const BString& oldStateDirectory);
|
||||
|
||||
status_t Error() const;
|
||||
BDaemonError DaemonError() const;
|
||||
// may be B_DAEMON_OK, even if Error() is
|
||||
// != B_OK, then Error() is as specific as
|
||||
// is known
|
||||
const BString& ErrorMessage() const;
|
||||
// may be empty, even on error
|
||||
const BString& ErrorPackage() const;
|
||||
// may be empty, even on error
|
||||
|
||||
BString FullErrorMessage() const;
|
||||
|
||||
const BString& OldStateDirectory() const;
|
||||
|
||||
private:
|
||||
int32 fError;
|
||||
BString fErrorMessage;
|
||||
BString fErrorPackage;
|
||||
BString fOldStateDirectory;
|
||||
};
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
} // namespace BPackageKit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user