Mailinglist Archive: zypp-devel (114 mails)
| < Previous | Next > |
[zypp-devel] Exception history
- From: Michael Andres <ma@xxxxxxx>
- Date: Fri, 27 Jul 2007 13:46:39 +0200
- Message-id: <20070727114639.GA13974@xxxxxxx>
(In SVN)
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.
History access:
/** Iterator pointing to the most recent message. */
HistoryIterator historyBegin() const
{ return _history.begin(); }
/** Iterator pointing behind the last message. */
HistoryIterator historyEnd() const
{ return _history.end(); }
/** Whether the history list is empty. */
bool historyEmpty() const
{ return _history.empty(); }
/** The size of the history list. */
HistorySize historySize() const
{ return _history.size(); }
History maintainance:
/** Store an other Exception as history. */
void remember( const Exception & old_r );
/** Add some message text to the history. */
void addHistory( const std::string & msg_r );
Example:
Rethrow, remembering an old exception:
try
{
....
}
catch( const Exception & olderr_r )
{
ZYPP_CAUGHT( olderr_r )
HighLevelException newerr( "Something failed." );
newerr.rember( olderr_r );
ZYPP_THROW( newerr );
}
Print exception and history if available:
Exception error;
dumpRange( ERR << error << endl,
err.historyBegin(), err.historyEnd(),
"",
"History:\n - ",
"\n - ",
"\n",
"" );
Todo:
Check and adjust existing code to remember previois Exceptions.
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |