Why exceptions for error handling is so important

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 11 05:25:48 PST 2015


On Sun, 11 Jan 2015 13:06:26 +0000
Dicebot via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

> What is your opinion of approach advertised by various functional 
> languages and now also Rust? Where you return error code packed 
> with actual data and can't access data without visiting error 
> code too, compiler simply won't allow it.
from my POV it trashes logic with error checking. hey, i don't care if
*each* `fwrite()` is successfull, i only care if all of them are ok or
at least one (any one) failed!

by the way: how many peope put checks for `close()`/`fclose()` return
value? it returns no actual data, so why bother...

i believe that exceptions are better for error checking: it's hard to
ignore errors, error handling logic is clearly separated and so on.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150111/90a136b4/attachment.sig>


More information about the Digitalmars-d mailing list