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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc745b8412f53f25 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-28 09:18:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Marius Amado Alves Newsgroups: comp.lang.ada Subject: Re: Error-names. Date: Sat, 28 Feb 2004 17:19:48 +0000 Organization: Cuivre, Argent, Or Message-ID: References: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: melchior.cuivre.fr.eu.org 1077988592 13533 212.85.156.195 (28 Feb 2004 17:16:32 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Sat, 28 Feb 2004 17:16:32 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: X-Mailer: KMail [version 1.3.2] In-Reply-To: X-OriginalArrivalTime: 28 Feb 2004 17:16:15.0418 (UTC) FILETIME=[925761A0:01C3FE1E] X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:5928 Date: 2004-02-28T17:19:48+00:00 Martin, First, embrace long names. The standard C expression is (I think) "error code", so go on and just write Constraint_Error_Code, General_Error_Code, etc. Second, I'm not sure I understand your tentative code but maybe I understand what you want. You want to handle all exceptions in one place, the handling being returning the corresponding error code. Well, the place has to be in a function that contains all the calls that may raise the exceptions: function Main return Error_Code_Type is -- exception-raising calls here exception when E : others => return Error_Code_Of (E); end; Now you only have to implement Error_Code_Of. (Ain't top-down design great? ;-) The 'trick' you could be missing is the "E : others" construct above. E is the exception occurence. From it you can go to the exception name. See package Ada.Exceptions--or, better yet, section 11.4 of the ARM.