Skip to content

Conversation

@N-Dekker
Copy link
Contributor

Instead of introducing a new virtual member function, DataObjectError::PrintSelf.

It is essential that DataObjectError overrides ExceptionObject::Print, because that is the member function that is called, when doing std::cerr << error for a DataObjectError.

Instead of introducing a new virtual member function,
`DataObjectError::PrintSelf`.

It is essential that DataObjectError overrides `ExceptionObject::Print`, because
that is the member function that is called, when doing `std::cerr << error` for
a DataObjectError.

- Fixes issue InsightSoftwareConsortium#5666
"DataObjectError print to output stream should also print info about its DataObject"
@github-actions github-actions bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances area:Core Issues affecting the Core module labels Nov 28, 2025
Copy link
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thinking of how this went on for so long, I realized I never used DataObjectError. I guess most code uses itk::ExceptionObject.

@N-Dekker N-Dekker marked this pull request as ready for review November 30, 2025 21:31
@N-Dekker
Copy link
Contributor Author

Thinking of how this went on for so long, I realized I never used DataObjectError. I guess most code uses itk::ExceptionObject.

DataObjectError is the base class of InvalidRequestedRegionError, which is thrown quite a few times (in more than 10 different places), in ITK/Modules. 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataObjectError print to output stream should also print info about its DataObject

2 participants