I’ve used this idiom in both C++ and Python. It’s the cleanest solution that I know of when what you want is an exception, rather than a log message. The downside to it is that the combined exception takes up linear space in general, which can be problematic when processing large datasets with many errors.