Skip to content

Commit 4b0566d

Browse files
authored
Merge pull request InsightSoftwareConsortium#5667 from N-Dekker/BUG-issue-5666-Let-DataObjectError-override-Print
BUG: Let DataObjectError override `ExceptionObject::Print`
2 parents 589d883 + 0a363fa commit 4b0566d

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

Modules/Core/Common/include/itkDataObject.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ class ITKCommon_EXPORT DataObjectError : public ExceptionObject
9090
* specific exception subtypes. The default is to print out the
9191
* location where the exception was first thrown and any description
9292
* provided by the "thrower". */
93-
virtual void
94-
PrintSelf(std::ostream & os, Indent indent) const;
93+
void
94+
Print(std::ostream & os) const override;
9595

9696
private:
9797
DataObject * m_DataObject{ nullptr };
@@ -126,14 +126,6 @@ class ITKCommon_EXPORT InvalidRequestedRegionError : public DataObjectError
126126

127127
/** \see LightObject::GetNameOfClass() */
128128
itkOverrideGetNameOfClassMacro(InvalidRequestedRegionError);
129-
130-
protected:
131-
/** Print exception information. This method can be overridden by
132-
* specific exception subtypes. The default is to print out the
133-
* location where the exception was first thrown and any description
134-
* provided by the "thrower". */
135-
void
136-
PrintSelf(std::ostream & os, Indent indent) const override;
137129
};
138130

139131
/*----------------------------Data Object--------------------------------*/

Modules/Core/Common/src/itkDataObject.cxx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ DataObjectError::GetDataObject() const noexcept
7070

7171

7272
void
73-
DataObjectError::PrintSelf(std::ostream & os, Indent indent) const
73+
DataObjectError::Print(std::ostream & os) const
7474
{
7575
ExceptionObject::Print(os);
7676

77+
const Indent indent{};
78+
7779
os << indent << "Data object: ";
7880
if (m_DataObject)
7981
{
@@ -99,12 +101,6 @@ InvalidRequestedRegionError::InvalidRequestedRegionError(const InvalidRequestedR
99101
InvalidRequestedRegionError &
100102
InvalidRequestedRegionError::operator=(const InvalidRequestedRegionError &) noexcept = default;
101103

102-
void
103-
InvalidRequestedRegionError::PrintSelf(std::ostream & os, Indent indent) const
104-
{
105-
DataObjectError::PrintSelf(os, indent);
106-
}
107-
108104
//----------------------------------------------------------------------------
109105
DataObject::DataObject()
110106
: m_SourceOutputName("")

0 commit comments

Comments
 (0)