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-28 11:47:52 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn51feed!worldnet.att.net!attbi_s03.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Error-names. References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 67.161.24.134 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s03 1077997670 67.161.24.134 (Sat, 28 Feb 2004 19:47:50 GMT) NNTP-Posting-Date: Sat, 28 Feb 2004 19:47:50 GMT Organization: Comcast Online Date: Sat, 28 Feb 2004 19:47:50 GMT Xref: archiver1.google.com comp.lang.ada:5936 Date: 2004-02-28T19:47:50+00:00 List-Id: >Well, if I understand it right, I still have to distinguish between >the different exceptions before I call Error_Code_Of, is this right? No. > > when E : others => return Error_Code_Of (E); works fine. 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; then function Set_Parameter_A... return Interfaces.C.Int is begin ... return ... -- return legitimate, non-exception, result exception when E : others => return Error_Code_Of(E); -- return exception code end Set...