You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dealing with nested exceptions, simply calling what() only reveals the message of the topmost exception, but all messages from the nested exceptions (which are typically more interesting) are ignored. In order to print all messages, something along the line of this is typically used (source)
It'd be great if formatting an exception with this library would also print the messages of the nested exceptions in order to save users the hassle of having to take care of this themselves.
However, since implementing this requires rethrowing, I guess this is incompatible with builds that disable exceptions altogether (which, as I understand it, is a support case for this library). I guess there has to be some preprocessor magic to remove this feature in builds without exceptions.
Godbolt: https://godbolt.org/z/Yc3KsY193 (currently fails to compile as apparently the version of fmt that is used doesn't support exceptions yet)
The text was updated successfully, but these errors were encountered:
However, since implementing this requires rethrowing, I guess this is incompatible with builds that disable exceptions altogether (which, as I understand it, is a support case for this library). I guess there has to be some preprocessor magic to remove this feature in builds without exceptions.
it actually doesn't require rethrowing necessarily, but it may require RTTI otherwise. (Dynamic cast to nested exception and then get the exception ptr of the nested exception).
As far as I can tell, support for formatting regular exceptions has been added via #3062 and this was then extended by #3076.
However, this implementation is currently missing support for nested exceptions (see e.g. https://cplusplus.com/reference/exception/nested_exception/ and https://riptutorial.com/cplusplus/example/18879/nested-exception).
When dealing with nested exceptions, simply calling
what()
only reveals the message of the topmost exception, but all messages from the nested exceptions (which are typically more interesting) are ignored. In order to print all messages, something along the line of this is typically used (source)It'd be great if formatting an exception with this library would also print the messages of the nested exceptions in order to save users the hassle of having to take care of this themselves.
However, since implementing this requires rethrowing, I guess this is incompatible with builds that disable exceptions altogether (which, as I understand it, is a support case for this library). I guess there has to be some preprocessor magic to remove this feature in builds without exceptions.
Godbolt: https://godbolt.org/z/Yc3KsY193 (currently fails to compile as apparently the version of
fmt
that is used doesn't support exceptions yet)The text was updated successfully, but these errors were encountered: