Exception can't work in multithreading
Scott S. McCoy
tag at cpan.org
Sun Mar 23 00:40:19 PDT 2008
On Mon, 2008-03-17 at 10:29 -0400, King Dark wrote:
>
> By the way, the "try catch" seems cannot catch the exception such as
> "divided by zero". It crushed after running such code.
Although your aforementioned problem appears relatively legitimate,
attempting to catch an exception resulting from division by zero is a
terribly bad practice. Try testing to see if the input value (the
untrusted value) is non-zero first instead. This is what reasonable
programs do (kind of like testing for an object being null before
calling a method on it, rather than trying to catch and handle the
exception which results from calling a method on a null value).
Cheers,
Scott S. McCoy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.puremagic.com/pipermail/d.gnu/attachments/20080323/646080d3/attachment.htm
More information about the D.gnu
mailing list