Mailinglist Archive: zypp-devel (114 mails)
| < Previous | Next > |
Re: [zypp-devel] Exception history
- From: Michael Andres <ma@xxxxxxx>
- Date: Fri, 27 Jul 2007 14:54:08 +0200
- Message-id: <20070727125408.GA17828@xxxxxxx>
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@xxxxxxxxxxxx
> For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
--
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
> > 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@xxxxxxxxxxxx
> For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
--
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 > |