Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2006-06-22 03:18:46


Emil Dotchevski wrote:
> catch( read_error & x )
> {
> if( info * xi = dynamic_cast<info *>(&x) )

you do not need dynamic_cast here, or you could just put
   catch(info& x)
above read_error?

> catch( info & xi )
> {
> xi.add( wrap_string<tag_src_file_name>(src_name) );
> xi.add( wrap_string<tag_dst_file_name>(dst_name) );
> throw;
> }

wow! I love it! I could add context information at higher levels of
application (when exception is "bubbling up") so that user gets relevant and
high-level information that he can match to what he was just doing. Nice!

> catch( io_error & x )
> {
> if( info * xi = dynamic_cast<info *>(&x) )

again, why dynamic_cast?

> And finally, I indicated in my previous post that attachments can be added
> directly in the throw-statement.

maybe these attachments could be separate and more general utility? I played
with idea of employing similar functionality in implementation of the context
design pattern.

> throw failed<fread_error>()
> << wrap_errno()
> << wrap_function("fread")
> << boost::weak_ptr<FILE>(f);

although I'm one of these malcontents who wince seeing << or >> applied
anywhere where they look cool, here they not only look cool but also make a
lot of sense. Nice again!

B.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk