On Fri, Jul 27, Martin Vidner wrote:
Example:
Rethrow, remembering an old exception:
try { .... } catch( const Exception & olderr_r ) { ZYPP_CAUGHT( olderr_r ) HighLevelException newerr( "Something failed." ); newerr.rember( olderr_r );
Good, in existing code only one line is added. How about operator += as an alias? :-)
No. It is more an assignment and not a +. Remember replaces any existing history.
ZYPP_THROW( newerr ); }
Print exception and history if available:
Exception error; dumpRange( ERR << error << endl, err.historyBegin(), err.historyEnd(), "", "History:\n - ", "\n - ", "\n", "" );
Well, this is quite cumbersome, a maze of *five* trailing arguments, all alike. Isn't there a shourtcut?
History is a container of strings, so you can use whatever formater you want. dumpRange is the most flexible we have, but if you're happy with /** The history as string. Empty if \ref historyEmpty. * Otherwise: * \code * History: * - most recent message * - 2nd message * ... * - oldest message * \endcode */ std::string historyAsString() const; So: ERR << error << endl << error.historyAsString();
Thanks! -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner
Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
-- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com 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@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org