Mailinglist Archive: zypp-devel (114 mails)
| < Previous | Next > |
Re: [zypp-devel] Exception history
- From: Martin Vidner <mvidner@xxxxxxx>
- Date: Fri, 27 Jul 2007 14:35:16 +0200
- Message-id: <20070727123516.GC1694@xxxxxxxxxxxxxxxx>
On Fri, Jul 27, 2007 at 01:46:39PM +0200, Michael Andres wrote:
> Class Exception now offers a history list of message strings.
> These messages should describe what lead to the exception.
Great, this is an important step to better present various
installation-time problems in YaST.
(Typical one: "Cannot add installation source" actually means "you have
unplugged the network cable")
> History access:
>...
> History maintainance:
>...
OK, I would have probably designed it simpler, using transparent
access to a string list, but this is perfectly usable too.
> 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? :-)
> 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?
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
> Class Exception now offers a history list of message strings.
> These messages should describe what lead to the exception.
Great, this is an important step to better present various
installation-time problems in YaST.
(Typical one: "Cannot add installation source" actually means "you have
unplugged the network cable")
> History access:
>...
> History maintainance:
>...
OK, I would have probably designed it simpler, using transparent
access to a string list, but this is perfectly usable too.
> 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? :-)
> 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?
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
| < Previous | Next > |