What should happen when the assert message expression throws?

Ali Çehreli acehreli at yahoo.com
Sun Nov 20 18:15:44 UTC 2022


On 11/18/22 05:06, Patrick Schluter wrote:

 > It's a bug in the program that has
 > to be corrected in any case. When it is corrected, the assert() will
 > manifest itself and can then be corrected also. When debugging a
 > program, I always concentrate on the first error/bug/exception as very
 > often subsequent errors/bugs/exceptions were more often than not just
 > consequences of undefined behaviour of the initial error.

I am in the habit of catching Exceptions in main() to print a 
human-friendly error message because those are just messages that the 
users should know about. Which means, the backtrace is missing for 
Exceptions.

In contrast, although embarrassing, I let Errors uncaught so the default 
behaviour of dumping the backtrace is preserved.

For that reason, this issue may hide useful information about bugs that 
are observed only be a user.

Ali



More information about the Digitalmars-d mailing list