[Insight-users] ImageFileWriter not throwing exceptions

BUI XUAN Viet V.Bui-Xuan at exeter.ac.uk
Mon, 26 Jan 2004 19:53:05 -0000


Hello everyone,

I use itk ImageFilewriters in my application and realized that
ImageFilewriter doesn't seem to throw exceptions when writing fails in
case of insufficient disk space (at least for RawImageIO).

Here's the code that I use:

> try {
> 	writer->Update ();
> } catch (itk::ExceptionObject &e) {
> 	
> }


ITK uses std::ofstream in order to write files, shouldn't it specify the
type of error on which it should throw exceptions as in:

> std::ofstream fp;
> fp.exceptions (std::ofstream::failbit | std::ofstream::badbit);

?

I may not use the writer properly...

Is there something I should do in order to catch the exception when disk
space is running out or is there something missing in the implementation
of the writer?

Regards

Viet