1 /* 2 * Copyright 2013, 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/Context.h> 13 14 15 namespace BPackageKit { 16 17 namespace BManager { 18 19 namespace BPrivate { 20 21 22 class BException { 23 public: 24 BException(); 25 BException(const BString& message); 26 27 const BString& Message() const 28 { return fMessage; } 29 30 protected: 31 BString fMessage; 32 }; 33 34 35 class BFatalErrorException : public BException { 36 public: 37 BFatalErrorException(); 38 BFatalErrorException(const char* format, ...); 39 BFatalErrorException(status_t error, 40 const char* format, ...); 41 42 const BString& Details() const 43 { return fDetails; } 44 BFatalErrorException& SetDetails(const BString& details); 45 46 status_t Error() const 47 { return fError; } 48 49 private: 50 BString fDetails; 51 status_t fError; 52 }; 53 54 55 class BAbortedByUserException : public BException { 56 public: 57 BAbortedByUserException(); 58 }; 59 60 61 class BNothingToDoException : public BException { 62 public: 63 BNothingToDoException(); 64 }; 65 66 67 } // namespace BPrivate 68 69 } // namespace BManager 70 71 } // namespace BPackageKit 72 73 74 #endif // _PACKAGE__MANAGER__PRIVATE__EXCEPTIONS_H_ 75