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,bc745b8412f53f25 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-29 11:03:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!HSNX.atgi.net!cyclone-sf.pbi.net!151.164.30.34!cyclone.swbell.net!newsfeed1.easynews.com!easynews.com!easynews!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Error-names. References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <2Iq0c.15247$aT1.13123@newsread1.news.pas.earthlink.net> Date: Sun, 29 Feb 2004 19:03:26 GMT NNTP-Posting-Host: 63.184.0.140 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1078081406 63.184.0.140 (Sun, 29 Feb 2004 11:03:26 PST) NNTP-Posting-Date: Sun, 29 Feb 2004 11:03:26 PST Xref: archiver1.google.com comp.lang.ada:5953 Date: 2004-02-29T19:03:26+00:00 List-Id: tmoran@acm.org wrote: > > subtype Exception_Codes is Interfaces.C.Int range -10 .. 1; > > Coded_Exception_List : constant array(Exception_Codes) > := (Constraint_Error'Identity, > Program_Error'Identity, > Storage_Error'Identity, > Tasking_Error'Identity, > Ada.IO_Exceptions.Status_Error'Identity, > Ada.IO_Exceptions.Mode_Error'Identity, > Ada.IO_Exceptions.Name_Error'Identity, > ... > > function Error_Code_Of(E : Ada.Exceptions.Exception_Occurrence) > return Exception_Codes is > use Ada.Exceptions; > begin > for i in Coded_Exception_List'range loop > if Exception_Identity(E) = Coded_Exception_List(i) then > return i; > end if; > end loop; > raise; -- we have no code for this exception! re-raise it > end Error_Code_Of; This is pretty much what I would have suggested if Moran hadn't beat me to it. However, I think you can't use "raise" here without an exception name, since we're not necessarily in an exception handler. You could use Ada.Exceptions.Raise_Exception (E), but I suspect what is really wanted, based on the OP's earlier messages, is to return General_Error_Code. -- Jeff Carter "No one is to stone anyone until I blow this whistle, do you understand? Even--and I want to make this absolutely clear--even if they do say, 'Jehova.'" Monty Python's Life of Brian 74