|
libzypp
17.7.0
|
Base class for Exception. More...
#include <Exception.h>

Public Types | |
| typedef exception_detail::CodeLocation | CodeLocation |
| typedef std::list< std::string > | History |
| typedef History::const_iterator | HistoryIterator |
| typedef History::size_type | HistorySize |
Public Member Functions | |
| Exception () | |
| Default ctor. More... | |
| Exception (const std::string &msg_r) | |
| Ctor taking a message. More... | |
| Exception (std::string &&msg_r) | |
| Exception (const std::string &msg_r, const Exception &history_r) | |
| Ctor taking a message and an exception to remember as history. More... | |
| Exception (std::string &&msg_r, const Exception &history_r) | |
| Exception (const std::string &msg_r, Exception &&history_r) | |
| Exception (std::string &&msg_r, Exception &&history_r) | |
| virtual | ~Exception () throw () |
| Dtor. More... | |
| const CodeLocation & | where () const |
| Return CodeLocation. More... | |
| void | relocate (const CodeLocation &where_r) const |
| Exchange location on rethrow. More... | |
| const std::string & | msg () const |
| Return the message string provided to the ctor. More... | |
| std::string | asString () const |
| Error message provided by dumpOn as string. More... | |
| std::string | asUserString () const |
| Translated error message as string suitable for the user. More... | |
History list of message strings. | |
Maintain a simple list of individual error messages, that lead to this Exception. The Exceptions message itself is not included in the history. The History list stores the most recent message fist. | |
| void | remember (const Exception &old_r) |
| Store an other Exception as history. More... | |
| void | remember (Exception &&old_r) |
| void | addHistory (const std::string &msg_r) |
| Add some message text to the history. More... | |
| void | addHistory (std::string &&msg_r) |
| template<class TContainer > | |
| void | addToHistory (const TContainer &msgc_r) |
| addHistory from string container types (oldest first) More... | |
| template<class TContainer > | |
| void | moveToHistory (TContainer &&msgc_r) |
| addHistory from string container types (oldest first) moving More... | |
| HistoryIterator | historyBegin () const |
| Iterator pointing to the most recent message. More... | |
| HistoryIterator | historyEnd () const |
| Iterator pointing behind the last message. More... | |
| bool | historyEmpty () const |
| Whether the history list is empty. More... | |
| HistorySize | historySize () const |
| The size of the history list. More... | |
| std::string | historyAsString () const |
| The history as string. More... | |
| std::string | asUserHistory () const |
| A single (multiline) string composed of asUserString and historyAsString. More... | |
Static Public Member Functions | |
| static std::string | strErrno (int errno_r) |
| Make a string from errno_r. More... | |
| static std::string | strErrno (int errno_r, const std::string &msg_r) |
| Make a string from errno_r and msg_r. More... | |
| static std::string | strErrno (int errno_r, std::string &&msg_r) |
| static void | log (const Exception &excpt_r, const CodeLocation &where_r, const char *const prefix_r) |
| Drop a logline on throw, catch or rethrow. More... | |
| static void | log (const char *typename_r, const CodeLocation &where_r, const char *const prefix_r) |
| for not-Exception types thrown via ZYPP_THROW More... | |
Protected Member Functions | |
| virtual std::ostream & | dumpOn (std::ostream &str) const |
| Overload this to print a proper error message. More... | |
Private Member Functions | |
| virtual const char * | what () const throw () |
| Return message string. More... | |
| std::ostream & | dumpError (std::ostream &str) const |
Called by std::ostream & operator<<. More... | |
Private Attributes | |
| CodeLocation | _where |
| std::string | _msg |
| History | _history |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const Exception &obj) |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &str, const Exception &obj) |
Base class for Exception.
Exception offers to store a message string passed to the ctor. Derived classes may provide additional information. Overload dumpOn to provide a proper error text.
The use of these macros is not mandatory. but ZYPP_THROW and ZYPP_RETHROW will adjust the code location information stored in the Exception. All three macros will drop a line in the logfile.
The above produces the following log lines:
Class Exception now offers a history list of message strings. These messages should describe what lead to the exception.
The Exceptions message itself is NOT included in the history.
Rethrow, remembering an old exception:
Print an Exception followed by it's history if available:
Definition at line 145 of file Exception.h.
Definition at line 150 of file Exception.h.
| typedef std::list<std::string> zypp::Exception::History |
Definition at line 151 of file Exception.h.
| typedef History::const_iterator zypp::Exception::HistoryIterator |
Definition at line 152 of file Exception.h.
| typedef History::size_type zypp::Exception::HistorySize |
Definition at line 153 of file Exception.h.
| zypp::Exception::Exception | ( | ) |
Default ctor.
Use ZYPP_THROW macros to throw exceptions.
Definition at line 45 of file Exception.cc.
| zypp::Exception::Exception | ( | const std::string & | msg_r | ) |
Ctor taking a message.
Use ZYPP_THROW macros to throw exceptions.
Definition at line 48 of file Exception.cc.
| zypp::Exception::Exception | ( | std::string && | msg_r | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 52 of file Exception.cc.
| zypp::Exception::Exception | ( | const std::string & | msg_r, |
| const Exception & | history_r | ||
| ) |
Ctor taking a message and an exception to remember as history.
Definition at line 56 of file Exception.cc.
| zypp::Exception::Exception | ( | std::string && | msg_r, |
| const Exception & | history_r | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 60 of file Exception.cc.
| zypp::Exception::Exception | ( | const std::string & | msg_r, |
| Exception && | history_r | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 64 of file Exception.cc.
| zypp::Exception::Exception | ( | std::string && | msg_r, |
| Exception && | history_r | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 68 of file Exception.cc.
|
virtual | |||||||||||||
Dtor.
Definition at line 72 of file Exception.cc.
|
inline |
Return CodeLocation.
Definition at line 183 of file Exception.h.
|
inline |
Exchange location on rethrow.
Definition at line 187 of file Exception.h.
|
inline |
Return the message string provided to the ctor.
Definition at line 195 of file Exception.h.
| std::string zypp::Exception::asString | ( | ) | const |
Error message provided by dumpOn as string.
Definition at line 75 of file Exception.cc.
| std::string zypp::Exception::asUserString | ( | ) | const |
Translated error message as string suitable for the user.
Definition at line 82 of file Exception.cc.
| void zypp::Exception::remember | ( | const Exception & | old_r | ) |
Store an other Exception as history.
Definition at line 105 of file Exception.cc.
| void zypp::Exception::remember | ( | Exception && | old_r | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 115 of file Exception.cc.
| void zypp::Exception::addHistory | ( | const std::string & | msg_r | ) |
Add some message text to the history.
Definition at line 125 of file Exception.cc.
| void zypp::Exception::addHistory | ( | std::string && | msg_r | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 128 of file Exception.cc.
|
inline |
addHistory from string container types (oldest first)
Definition at line 227 of file Exception.h.
|
inline |
addHistory from string container types (oldest first) moving
Definition at line 234 of file Exception.h.
|
inline |
Iterator pointing to the most recent message.
Definition at line 241 of file Exception.h.
|
inline |
Iterator pointing behind the last message.
Definition at line 245 of file Exception.h.
|
inline |
Whether the history list is empty.
Definition at line 249 of file Exception.h.
|
inline |
The size of the history list.
Definition at line 253 of file Exception.h.
| std::string zypp::Exception::historyAsString | ( | ) | const |
The history as string.
Empty if historyEmpty. Otherwise:
Definition at line 131 of file Exception.cc.
| std::string zypp::Exception::asUserHistory | ( | ) | const |
A single (multiline) string composed of asUserString and historyAsString.
Definition at line 91 of file Exception.cc.
|
protectedvirtual |
Overload this to print a proper error message.
Reimplemented in zypp::media::MediaBadCAException, zypp::media::MediaTemporaryProblemException, zypp::media::MediaFileSizeExceededException, zypp::media::MediaTimeoutException, zypp::media::MediaForbiddenException, zypp::media::MediaUnauthorizedException, zypp::media::MediaNotEjectedException, zypp::media::MediaIsSharedException, zypp::media::MediaNotDesiredException, zypp::media::MediaCurlSetOptException, zypp::media::MediaCurlException, zypp::media::MediaNotSupportedException, zypp::media::MediaUnsupportedUrlSchemeException, zypp::media::MediaBadUrlEmptyDestinationException, zypp::media::MediaBadUrlEmptyFilesystemException, zypp::media::MediaBadUrlEmptyHostException, zypp::media::MediaBadUrlException, zypp::media::MediaNotADirException, zypp::media::MediaNotAFileException, zypp::target::rpm::RpmNullDatabaseException, zypp::media::MediaSystemException, zypp::target::rpm::RpmDbConvertException, zypp::media::MediaCurlInitException, zypp::target::rpm::RpmDbNotOpenException, zypp::media::MediaBadAttachPointException, zypp::target::rpm::RpmDbAlreadyOpenException, zypp::repo::ServiceException, zypp::media::MediaNotAttachedException, zypp::target::rpm::RpmDbOpenException, zypp::media::MediaWriteException, zypp::media::MediaFileNotFoundException, zypp::target::rpm::RpmInitException, zypp::media::MediaNotOpenException, zypp::target::rpm::RpmSubprocessException, zypp::media::MediaBadFilenameException, zypp::target::rpm::RpmAccessBlockedException, zypp::media::MediaUnmountException, zypp::target::rpm::RpmInvalidRootException, zypp::target::hal::HalException, zypp::media::MediaMountException, zypp::UserRequestException, zypp::target::TargetAbortedException, zypp::repo::RepoException, and zypp::parser::ParseException.
Definition at line 141 of file Exception.cc.
|
static |
Make a string from errno_r.
Definition at line 151 of file Exception.cc.
|
static |
Make a string from errno_r and msg_r.
Definition at line 154 of file Exception.cc.
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 157 of file Exception.cc.
|
static |
Drop a logline on throw, catch or rethrow.
Used by ZYPP_THROW macros macros.
Definition at line 163 of file Exception.cc.
|
static |
for not-Exception types thrown via ZYPP_THROW
Definition at line 169 of file Exception.cc.
|
inlineprivatevirtual | |||||||||||||
Return message string.
Definition at line 300 of file Exception.h.
|
private |
Called by std::ostream & operator<<.
Prints CodeLocation and the error message provided by dumpOn.
Definition at line 144 of file Exception.cc.
|
friend |
Definition at line 147 of file Exception.cc.
|
related |
Stream output
Definition at line 147 of file Exception.cc.
|
mutableprivate |
Definition at line 295 of file Exception.h.
|
private |
Definition at line 296 of file Exception.h.
|
private |
Definition at line 297 of file Exception.h.