LWN.net Logo

Exceptions vs Error Codes

Exceptions vs Error Codes

Posted Mar 30, 2012 11:56 UTC (Fri) by mgedmin (subscriber, #34497)
In reply to: Exceptions vs Error Codes by dgm
Parent article: Go version 1 released

> You can have a global error object (à la errno) and pass up the error _condition_ (that is, that there has been an error).

This pattern is the reason why the Internet is full of screenshots of those "Error: success" dialogs.


(Log in to post comments)

Exceptions vs Error Codes

Posted Mar 30, 2012 15:51 UTC (Fri) by khim (subscriber, #9252) [Link]

True. But think about it: just why all these pictures are copied from one resource to another? Because they are rare and thus funny.

On the other hand uncaught exception dumped on the unsuspected user are so common nobody ever tries to ridicule them: it's not funny, it's just sad.

IMNSHO this shows that usually exceptions are not needed and dangerous (just like usually full GC is unneeded and problematic), but some help is welcome. Multiple return values in Go looks like goo 99% compromise. Just as scoped_ptr plus occasional shared_ptr are good compromise WRT GC - to bad Go advocates full GC...

Exceptions vs Error Codes

Posted Mar 30, 2012 18:26 UTC (Fri) by dgm (subscriber, #49227) [Link]

Rather, it's more likely that the cause is using an special code to mean "no error".

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds