Google's Go

Walter Bright newshound1 at digitalmars.com
Sat Jan 23 12:59:53 PST 2010


dsimcha wrote:
> IMHO the best thing
> about exceptions is that they provide a sane default for error handling:  If you
> don't handle them then you've effectively asserted that they can't happen in your
> situation.  If this "assertion" fails, then our program fails fast and with an
> error message that massively narrows down where the problem is.


It's even better than that. Since the default handling for exceptions is 
to print a pretty message, like "cannot open file xxxxx", for many 
utility programs that is all you need. You don't have to write any error 
handling code, and yet your program handles errors correctly and 
gracefully reports them to the user.



More information about the Digitalmars-d mailing list