From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,88c174f3c455ecdc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-08 05:11:49 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!uni-erlangen.de!news-nue1.dfn.de!newsfeed.r-kom.de!newsfeed.stueberl.de!newsfeed.vmunix.org!newsfeed2.easynews.net!easynews.net!news.cid.net!news.enyo.de!news1.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: Thoughts on the ADaOS user program interface Date: Sat, 08 Sep 2001 13:42:27 +0200 Organization: Enyo's not your organization Message-ID: <87sndxdi3g.fsf@deneb.enyo.de> References: <9n8eks$qsp$1@shell.monmouth.com> <3B98FA64.4080907@home.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Xref: archiver1.google.com comp.lang.ada:12930 Date: 2001-09-08T13:42:27+02:00 List-Id: "Warren W. Gay VE3WWG" writes: >> Error reporting should be done by throwing exceptions with a descriptive >> error message attached. My experience is that more often than not, >> if a system call fails the program logic doesn't care why it fails. > I have to disagree here. This may often be the case in some class of > applications, but servers and other more system-level software _do_ > indeed care, and often must take appropriate action. You can have the best of both worlds. I call this "parameterized exceptions": The exception message contains a machine-readable error code at the beginning (which can be something converted to a human-readable string, too), and exception handlers can retrieve this kind of information easily. As a side effect, throwing exceptions becomes more expensive, but I think that this is not a problem. I'm going to use this approach to get rid of thread-specific state (and the alternative, a myriad of different exceptions) for my low-level Ada binding for POSIX-like operating systems. IMHO, the possibility to pass a value of a discrete type as a parameter along with exceptions would be nice addition to the language (passing values of any type creates too much problems).