xref: /haiku/headers/private/package/manager/Exceptions.h (revision eee422752c6de8ab971937a81225008d254ad785)
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 
16 namespace BPackageKit {
17 
18 namespace BManager {
19 
20 namespace BPrivate {
21 
22 
23 class BException {
24 public:
25 								BException();
26 								BException(const BString& message);
27 
Message()28 			const BString&		Message() const
29 									{ return fMessage; }
30 
31 protected:
32 			BString				fMessage;
33 };
34 
35 
36 class BFatalErrorException : public BException {
37 public:
38 								BFatalErrorException();
39 								BFatalErrorException(const char* format, ...);
40 								BFatalErrorException(status_t error,
41 									const char* format, ...);
42 								BFatalErrorException(
43 									const BCommitTransactionResult& result);
44 
Details()45 			const BString&		Details() const
46 									{ return fDetails; }
47 			BFatalErrorException& SetDetails(const BString& details);
48 
Error()49 			status_t			Error() const
50 									{ return fError; }
51 
HasCommitTransactionFailed()52 			bool				HasCommitTransactionFailed() const
53 									{ return fCommitTransactionFailed; }
CommitTransactionResult()54 			const BCommitTransactionResult& CommitTransactionResult() const
55 									{ return fCommitTransactionResult; }
56 
57 private:
58 			BString				fDetails;
59 			status_t			fError;
60 			BCommitTransactionResult fCommitTransactionResult;
61 			bool				fCommitTransactionFailed;
62 };
63 
64 
65 class BAbortedByUserException : public BException {
66 public:
67 								BAbortedByUserException();
68 };
69 
70 
71 class BNothingToDoException : public BException {
72 public:
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