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
Currently, exceptions not derived from std::exception (other than raw strings) are caught by CATCH, but it doesn't know how to get any messages out.
A mechanism is needed to be able to specify custom exception types so more informative messages can be given.
I can't think of any clean (portable) ways to do this OTTOMH, but one way to "hack it" would be to have a macro, CUSTOM_EXCEPTION_TYPE, as well as CUSTOM_EXCEPTION_HANDLER, which would allow the user to specify a type and how to get the string out respectively.
This has a number of drawbacks. Apart from being very ugly it only allows one custom exception type to be specified (unless we have CUSTOM_EXCEPTION_TYPE2 etc), and the caller has to make sure the macros are defined before catch is included.
Any better ideas are very welcome!
The text was updated successfully, but these errors were encountered:
Thanks to James Bates, who suggested that a ... handler can call out to external functions that can rethrow within another try-catch and catch the exception by type there.
Currently, exceptions not derived from std::exception (other than raw strings) are caught by CATCH, but it doesn't know how to get any messages out.
A mechanism is needed to be able to specify custom exception types so more informative messages can be given.
I can't think of any clean (portable) ways to do this OTTOMH, but one way to "hack it" would be to have a macro, CUSTOM_EXCEPTION_TYPE, as well as CUSTOM_EXCEPTION_HANDLER, which would allow the user to specify a type and how to get the string out respectively.
This has a number of drawbacks. Apart from being very ugly it only allows one custom exception type to be specified (unless we have CUSTOM_EXCEPTION_TYPE2 etc), and the caller has to make sure the macros are defined before catch is included.
Any better ideas are very welcome!
The text was updated successfully, but these errors were encountered: