Skip to content

Commit

Permalink
STYLE: Replace "itk::ERROR" by "ITK ERROR" in description of exception
Browse files Browse the repository at this point in the history
Previously, the description text of an exception thrown by
`itkSpecializedMessageExceptionMacro` would start with the text
"itk::ERROR", which seemed to suggest that it involved an `itk::ERROR`
object, function, or type. However, there is no such `ERROR` in the
`itk` namespace!

It appears clearer to use the text "ITK ERROR" instead, to indicate
that the error involves the ITK library.
  • Loading branch information
N-Dekker authored and dzenanz committed Mar 12, 2021
1 parent e6d5e09 commit 2b34388
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ OutputWindowDisplayDebugText(const char *);
#define itkSpecializedMessageExceptionMacro(ExceptionType, x) \
{ \
std::ostringstream message; \
message << "itk::ERROR: " x; \
message << "ITK ERROR: " x; \
throw ::itk::ExceptionType( \
std::string{ __FILE__ }, __LINE__, std::string{ message.str() }, std::string{ ITK_LOCATION }); \
} \
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/test/itkExceptionObjectGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TEST(ExceptionObject, TestDescriptionFromExceptionMacro)
ASSERT_NE(actualDescription, nullptr);

std::ostringstream expectedDescription;
expectedDescription << "itk::ERROR: " << testObject.GetNameOfClass() << "(" << &testObject << "): " << testMessage;
expectedDescription << "ITK ERROR: " << testObject.GetNameOfClass() << "(" << &testObject << "): " << testMessage;

EXPECT_EQ(actualDescription, expectedDescription.str());
}
Expand All @@ -78,7 +78,7 @@ TEST(ExceptionObject, TestDescriptionFromSpecializedExceptionMacro)
{
const char * const description = exceptionObject.GetDescription();
ASSERT_NE(description, nullptr);
EXPECT_EQ(description, std::string("itk::ERROR: ") + itk::GTest_SpecializedException::default_exception_message);
EXPECT_EQ(description, std::string("ITK ERROR: ") + itk::GTest_SpecializedException::default_exception_message);
}
}

Expand Down

0 comments on commit 2b34388

Please sign in to comment.