1/*
2 * Copyright 2013-2014, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Ingo Weinhold <ingo_weinhold@gmx.de>
7 */
8#ifndef _PACKAGE__MANAGER__PRIVATE__EXCEPTIONS_H_
9#define _PACKAGE__MANAGER__PRIVATE__EXCEPTIONS_H_
10
11
12#include <package/CommitTransactionResult.h>
13#include <package/Context.h>
14
15
16namespace BPackageKit {
17
18namespace BManager {
19
20namespace BPrivate {
21
22
23class BException {
24public:
25								BException();
26								BException(const BString& message);
27
28			const BString&		Message() const
29									{ return fMessage; }
30
31protected:
32			BString				fMessage;
33};
34
35
36class BFatalErrorException : public BException {
37public:
38								BFatalErrorException();
39								BFatalErrorException(const char* format, ...);
40								BFatalErrorException(status_t error,
41									const char* format, ...);
42								BFatalErrorException(
43									const BCommitTransactionResult& result);
44
45			const BString&		Details() const
46									{ return fDetails; }
47			BFatalErrorException& SetDetails(const BString& details);
48
49			status_t			Error() const
50									{ return fError; }
51
52			bool				HasCommitTransactionFailed() const
53									{ return fCommitTransactionFailed; }
54			const BCommitTransactionResult& CommitTransactionResult() const
55									{ return fCommitTransactionResult; }
56
57private:
58			BString				fDetails;
59			status_t			fError;
60			BCommitTransactionResult fCommitTransactionResult;
61			bool				fCommitTransactionFailed;
62};
63
64
65class BAbortedByUserException : public BException {
66public:
67								BAbortedByUserException();
68};
69
70
71class BNothingToDoException : public BException {
72public:
73								BNothingToDoException();
74};
75
76
77}	// namespace BPrivate
78
79}	// namespace BManager
80
81}	// namespace BPackageKit
82
83
84#endif	// _PACKAGE__MANAGER__PRIVATE__EXCEPTIONS_H_
85