[Insight-developers] exception swallowed by ImageFileReader::GenerateOutputInformation()

Steve M. Robbins steve at sumost.ca
Mon Jul 9 13:58:49 EDT 2007


Hi,

I'm perusing the code of ImageIO and friends.  The following snippet
caught my eye:

template <class TOutputImage, class ConvertPixelTraits>
void ImageFileReader<TOutputImage, ConvertPixelTraits>::GenerateOutputInformation(void)
{
  [... elided ...]
  
  // Test if the file exist and if it can be open.
  // and exception will be thrown otherwise.
  //
  try
    {
    m_ExceptionMessage = "";
    this->TestFileExistanceAndReadability();
    }
  catch(itk::ExceptionObject &err)
    {
    m_ExceptionMessage = err.GetDescription();
    }

  [...]

The method goes on to read the image information and set up the
output.

I'm a little concerned that the exception from
TestFileExistanceAndReadability() is swallowed.
Wouldn't it make sense to simply let the exception
propagate?

-Steve

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20070709/8e03ad02/attachment.pgp


More information about the Insight-developers mailing list