List of exceptions?
acehreli at yahoo.com
Mon Oct 12 16:53:47 UTC 2020
On 10/12/20 2:11 AM, Dominikus Dittes Scherkl wrote:
> - Throw exceptions only if you have a plan what to do with them if you
> catch them.
My thinking is different: Throw exceptions if you can't accomplish a
task. My code is filled with enforce() and assert() checks, which do
> - If you have no plan, better throw error, just to get an idea where and
> why the program crashed (and don't try to catch them)
In most cases, catching Exception (not Error) to print exc.msg is fine
and is the correct thing to do. (Errors are not caught, the stack trace
is printed, and that's helpful.)
Occasionally, exc.msg of an Exception doesn't give enough information.
So, printing exc (not exc.msg) temporarily to look at the stack trace is
More information about the Digitalmars-d-learn