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 07:28:33 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!martinkl.dialup.fu-berlin.DE!not-for-mail From: Martin Klaiber Newsgroups: comp.lang.ada Subject: Re: Error-names. Date: Sat, 28 Feb 2004 16:26:50 +0100 Organization: Freie Universitaet Berlin Sender: Martin Klaiber Message-ID: References: NNTP-Posting-Host: martinkl.dialup.fu-berlin.de (130.133.237.205) X-Trace: news.uni-berlin.de 1077982111 55791307 F 130.133.237.205 (10182) X-Orig-Path: not-for-mail User-Agent: tin/1.5.12-20020427 ("Sugar") (UNIX) (Linux/2.4.24 (i586)) Xref: archiver1.google.com comp.lang.ada:5924 Date: 2004-02-28T16:26:50+01:00 List-Id: Martin Dowie wrote: >> My problem now is that I also want to define return values for >> exceptions like Constraint_Error. But I can't define something like: >> Constraint_Error : C_Integer := -3; > You could change all the names round e.g. > Error_Constraint > Error_Routine_Not_Defined. > etc. I was also thinking of that. But the last one could be misunderstood as: there is an error-routine not defined (IMHO). Perhaps I rename the 'Constraint'-part instead and call the constant 'Range_Error' or so. BTW: is there a way to handle all exceptions in one place? I have many functions (about 20 or more, they all set or get parameters) which all need this exception-handling. I was trying a solution like: function Handle_Exceptions return C_Integer is begin return 0; exception when Some_Exception => return Some_Exception_Error; when ... when ... when others => return General_Error; end Handle_Exceptions; function Set_Something return C_Integer is begin ... -- set the parameter return 0; exception when others => return Handle_Exceptions; raise; end Set_Something; and so on with all the other set- and get-functions. But I get a warning that 'raise' is unreachable code and when I try it out, it looks like the exception is really not re-raised. Thx, Martin