From fcf8b39ac80ef9ec66b19a09c1fe9dfb1588628d Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Thu, 4 Aug 2022 12:06:56 -0500 Subject: [PATCH] ENH: Convert unspecified exceptions to itk Ensure that caught exceptions are converted to itk::Exception objects. --- Modules/IO/HDF5/src/itkHDF5ImageIO.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Modules/IO/HDF5/src/itkHDF5ImageIO.cxx b/Modules/IO/HDF5/src/itkHDF5ImageIO.cxx index 3bcba5d4ab7..f8801afc781 100644 --- a/Modules/IO/HDF5/src/itkHDF5ImageIO.cxx +++ b/Modules/IO/HDF5/src/itkHDF5ImageIO.cxx @@ -903,6 +903,11 @@ HDF5ImageIO ::ReadImageInformation() { itkExceptionMacro(<< error.getCDetailMsg()); } + catch (...) + { + itkExceptionMacro(<< "Unspecified error occured during ReadImageInformation " << this->GetFileName() << " with " + << this->GetNameOfClass()); + } } void @@ -1246,6 +1251,11 @@ HDF5ImageIO ::WriteImageInformation() { itkExceptionMacro(<< error.getCDetailMsg()); } + catch (...) + { + itkExceptionMacro(<< "Unspecified error occured during WriteImageInformation: " << this->GetFileName() << " with " + << this->GetNameOfClass()); + } // // only write image information once. this->m_ImageInformationWritten = true; @@ -1301,6 +1311,11 @@ HDF5ImageIO ::Write(const void * buffer) { itkExceptionMacro(<< error.getCDetailMsg()); } + catch (...) + { + itkExceptionMacro(<< "Unspecified error occured during Write: " << this->GetFileName() << " with " + << this->GetNameOfClass()); + } } //